line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::NDTools::NDProc::Module::Remove; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
448
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
159
|
|
4
|
5
|
|
|
5
|
|
25
|
use warnings FATAL => 'all'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
208
|
|
5
|
5
|
|
|
5
|
|
28
|
use parent 'App::NDTools::NDProc::Module'; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
29
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
232
|
use Log::Log4Cli; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
395
|
|
8
|
5
|
|
|
5
|
|
27
|
use Struct::Path 0.80 qw(path); |
|
5
|
|
|
|
|
78
|
|
|
5
|
|
|
|
|
224
|
|
9
|
5
|
|
|
5
|
|
28
|
use Struct::Path::PerlStyle 0.80 qw(path2str); |
|
5
|
|
|
|
|
58
|
|
|
5
|
|
|
|
|
1514
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
0
|
8
|
sub MODINFO { "Remove specified parts from structure" } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub arg_opts { |
16
|
13
|
|
|
13
|
0
|
22
|
my $self = shift; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
return ( |
19
|
|
|
|
|
|
|
$self->SUPER::arg_opts(), |
20
|
|
|
|
|
|
|
'strict' => \$self->{OPTS}->{strict}, |
21
|
|
|
|
|
|
|
) |
22
|
13
|
|
|
|
|
36
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub check_rule { |
25
|
27
|
|
|
27
|
0
|
53
|
my ($self, $rule) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
die_fatal "At least one path should be specified", 1 |
28
|
27
|
100
|
66
|
|
|
80
|
unless ($rule->{path} and @{$rule->{path}}); |
|
27
|
|
|
|
|
86
|
|
29
|
|
|
|
|
|
|
|
30
|
26
|
|
|
|
|
64
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub process_path { |
34
|
26
|
|
|
26
|
0
|
59
|
my ($self, $data, $path, $spath, $opts) = @_; |
35
|
|
|
|
|
|
|
|
36
|
26
|
100
|
|
|
|
37
|
return ${$data} = undef unless (@{$spath}); |
|
2
|
|
|
|
|
7
|
|
|
26
|
|
|
|
|
60
|
|
37
|
|
|
|
|
|
|
|
38
|
24
|
|
|
|
|
35
|
my @list = eval { path(${$data}, $spath, paths => 1, strict => $opts->{strict}) }; |
|
24
|
|
|
|
|
31
|
|
|
24
|
|
|
|
|
107
|
|
39
|
24
|
100
|
|
|
|
6714
|
die_fatal "Failed to resolve path '$path'", 4 if ($@); |
40
|
|
|
|
|
|
|
|
41
|
23
|
|
|
|
|
58
|
while (@list) { |
42
|
49
|
|
|
|
|
2640
|
my ($p, undef) = splice @list, -2, 2; |
43
|
|
|
|
|
|
|
|
44
|
49
|
|
|
0
|
|
199
|
log_info { "Removing path '" . path2str($p). "'" }; |
|
0
|
|
|
|
|
0
|
|
45
|
49
|
|
|
|
|
173
|
path(${$data}, $p, delete => 1, strict => 1); |
|
49
|
|
|
|
|
97
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; # End of App::NDTools::NDProc::Module::Remove |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |