line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mac::PropertyListFilter; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
68694
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA @EXPORT_OK $VERSION); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
1682
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
@EXPORT_OK = qw( xml_filter ); |
11
|
|
|
|
|
|
|
$VERSION = '0.02'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub xml_filter { |
14
|
2
|
|
|
2
|
0
|
7445
|
my ($href,$filter) = @_; |
15
|
2
|
|
|
|
|
7
|
my $output; |
16
|
2
|
50
|
|
|
|
80
|
if($href->{type} eq 'dict') { |
|
|
50
|
|
|
|
|
|
17
|
0
|
|
|
|
|
0
|
for(keys %{$href->{value}}) { |
|
0
|
|
|
|
|
0
|
|
18
|
0
|
|
|
|
|
0
|
$output->{$_} = xml_filter($href->{value}{$_},$filter); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
elsif($href->{type} eq 'array') { |
22
|
0
|
|
|
|
|
0
|
for(@{$href->{value}}) { |
|
0
|
|
|
|
|
0
|
|
23
|
0
|
|
|
|
|
0
|
push @$output,xml_filter($_,$filter); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { # Non-structural types |
27
|
2
|
|
|
|
|
6
|
$output = $href->{value}; |
28
|
|
|
|
|
|
|
} |
29
|
2
|
|
|
|
|
12
|
for(@$filter) { |
30
|
1
|
|
|
|
|
6
|
my $transformed = $_->($output); |
31
|
1
|
50
|
33
|
|
|
14
|
$output = $transformed if $transformed and $transformed ne ''; |
32
|
|
|
|
|
|
|
} |
33
|
2
|
|
|
|
|
16
|
return $output; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |