line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Code::TidyAll::Plugin::SVG; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
11550
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
90
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
92
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
371
|
use XML::Twig; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Moo; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Code::TidyAll::Plugin'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JONASS'; |
12
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'indent' => ( is => 'ro', default => sub {"\n"} ); |
15
|
|
|
|
|
|
|
has 'style' => ( is => 'ro', default => sub {'cvs'} ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub transform_file |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
my $self = shift; |
20
|
|
|
|
|
|
|
my $file = shift; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $svg = XML::Twig->new( |
23
|
|
|
|
|
|
|
keep_encoding => 1, |
24
|
|
|
|
|
|
|
pretty_print => $self->style, |
25
|
|
|
|
|
|
|
twig_handlers => { |
26
|
|
|
|
|
|
|
_all_ => sub { $_[0]->flush; }, |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$svg->set_indent( $self->indent ) if $self->indent; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$svg->parsefile_inplace($file); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |