line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Printer::Filter; |
2
|
32
|
|
|
32
|
|
195
|
use strict; |
|
32
|
|
|
|
|
60
|
|
|
32
|
|
|
|
|
912
|
|
3
|
32
|
|
|
32
|
|
135
|
use warnings; |
|
32
|
|
|
|
|
60
|
|
|
32
|
|
|
|
|
632
|
|
4
|
32
|
|
|
32
|
|
143
|
use Data::Printer::Common; |
|
32
|
|
|
|
|
56
|
|
|
32
|
|
|
|
|
946
|
|
5
|
32
|
|
|
32
|
|
160
|
use Scalar::Util; |
|
32
|
|
|
|
|
58
|
|
|
32
|
|
|
|
|
6033
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
324
|
|
|
324
|
|
778
|
my $caller = caller; |
9
|
|
|
|
|
|
|
|
10
|
324
|
|
|
|
|
558
|
my %_filters_for = (); |
11
|
|
|
|
|
|
|
my $filter = sub { |
12
|
393
|
|
|
393
|
|
1040
|
my ($name, $code) = @_; |
13
|
393
|
50
|
33
|
|
|
2803
|
Data::Printer::Common::_die( "syntax: filter 'Class', sub { ... }" ) |
|
|
|
33
|
|
|
|
|
14
|
|
|
|
|
|
|
unless defined $name |
15
|
|
|
|
|
|
|
&& defined $code |
16
|
|
|
|
|
|
|
&& Scalar::Util::reftype($code) eq 'CODE'; |
17
|
|
|
|
|
|
|
|
18
|
393
|
|
|
|
|
981
|
my $target = Data::Printer::Common::_filter_category_for($name); |
19
|
393
|
|
|
|
|
2398
|
unshift @{$_filters_for{$target}{$name}}, sub { |
20
|
633
|
|
|
633
|
|
1072
|
my ($item, $ddp) = @_; |
21
|
633
|
|
|
|
|
1877
|
$code->($item, $ddp); |
22
|
393
|
|
|
|
|
563
|
}; |
23
|
324
|
|
|
|
|
1566
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
{ |
26
|
32
|
|
|
32
|
|
223
|
no strict 'refs'; |
|
32
|
|
|
|
|
58
|
|
|
32
|
|
|
|
|
2967
|
|
|
324
|
|
|
|
|
579
|
|
27
|
324
|
|
|
|
|
452
|
*{"$caller\::filter"} = $filter; |
|
324
|
|
|
|
|
1543
|
|
28
|
324
|
|
|
2466
|
|
1082
|
*{"$caller\::_filter_list"} = sub { \%_filters_for }; |
|
324
|
|
|
|
|
10911
|
|
|
2466
|
|
|
|
|
4741
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |