line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Cmd::compile; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
292563
|
use Catmandu::Sane; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
159
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
14
|
|
|
14
|
|
129
|
use parent 'Catmandu::Cmd'; |
|
14
|
|
|
|
|
48
|
|
|
14
|
|
|
|
|
98
|
|
8
|
14
|
|
|
14
|
|
1274
|
use Catmandu; |
|
14
|
|
|
|
|
38
|
|
|
14
|
|
|
|
|
110
|
|
9
|
14
|
|
|
14
|
|
4364
|
use Data::Dumper; |
|
14
|
|
|
|
|
44
|
|
|
14
|
|
|
|
|
853
|
|
10
|
14
|
|
|
14
|
|
113
|
use namespace::clean; |
|
14
|
|
|
|
|
33
|
|
|
14
|
|
|
|
|
107
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub command_opt_spec { |
13
|
|
|
|
|
|
|
( |
14
|
1
|
|
|
1
|
1
|
17
|
["var=s%", ""], |
15
|
|
|
|
|
|
|
["preprocess|pp", ""], |
16
|
|
|
|
|
|
|
["fix|fix=s@", "", {hidden => 1}], |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub command { |
21
|
1
|
|
|
1
|
1
|
4
|
my ($self, $opts, $args) = @_; |
22
|
|
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
5
|
unless (@$args == 1) { |
24
|
0
|
|
|
|
|
0
|
say STDERR "usage: $0 compile <FILE>|<FIX> [<FILE>|<FIX> [...]]\n"; |
25
|
0
|
|
|
|
|
0
|
exit 1; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
3
|
$opts->{fix} = $args; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
7
|
my $fixer = $self->_build_fixer($opts); |
31
|
1
|
|
|
|
|
1930
|
my $fixes = $fixer->emit; |
32
|
1
|
|
|
|
|
26
|
my $captures = Dumper($fixer->_captures); |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
122
|
$captures =~ s/^\$VAR1/\$_[1]/; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
80
|
print $captures; |
37
|
1
|
|
|
|
|
51
|
print $fixes; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Catmandu::Cmd::compile - compile a Fix into Perl (for debugging) |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 EXAMPLES |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
catmandu compile <FILE>|<FIX> [<FILE>|<FIX> [...]] |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
catmandu compile 'add_field(foo,bar.$append)' | perltidy -utf8 -npro -st -se |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |