line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::xml_transform; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.16'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
16138
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
73843
|
|
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
257
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
1103
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
970
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
915
|
use Catmandu::XML::Transformer; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Catmandu::Fix::Base'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has field => (fix_arg => 1); |
13
|
|
|
|
|
|
|
has file => (fix_opt => 1); |
14
|
|
|
|
|
|
|
has format => (fix_opt => 1); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has _transformer => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
lazy => 1, |
19
|
|
|
|
|
|
|
default => sub { |
20
|
|
|
|
|
|
|
Catmandu::XML::Transformer->new( |
21
|
|
|
|
|
|
|
stylesheet => $_[0]->file, |
22
|
|
|
|
|
|
|
output_format => $_[0]->format, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub emit { |
28
|
|
|
|
|
|
|
my ($self,$fixer) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $path = $fixer->split_path($self->field()); |
31
|
|
|
|
|
|
|
my $key = pop @$path; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $transformer = $fixer->capture($self->_transformer); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return $fixer->emit_walk_path($fixer->var,$path,sub{ |
36
|
|
|
|
|
|
|
my $var = $_[0]; |
37
|
|
|
|
|
|
|
$fixer->emit_get_key($var,$key,sub{ |
38
|
|
|
|
|
|
|
my $var = $_[0]; |
39
|
|
|
|
|
|
|
return "${var} = ${transformer}->transform(${var});"; |
40
|
|
|
|
|
|
|
}); |
41
|
|
|
|
|
|
|
}); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
__END__ |