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