line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Printer::Filter::CODE; |
2
|
32
|
|
|
32
|
|
186
|
use strict; |
|
32
|
|
|
|
|
57
|
|
|
32
|
|
|
|
|
815
|
|
3
|
32
|
|
|
32
|
|
149
|
use warnings; |
|
32
|
|
|
|
|
49
|
|
|
32
|
|
|
|
|
634
|
|
4
|
32
|
|
|
32
|
|
141
|
use Data::Printer::Filter; |
|
32
|
|
|
|
|
49
|
|
|
32
|
|
|
|
|
159
|
|
5
|
32
|
|
|
32
|
|
161
|
use Data::Printer::Common; |
|
32
|
|
|
|
|
59
|
|
|
32
|
|
|
|
|
553
|
|
6
|
32
|
|
|
32
|
|
135
|
use Scalar::Util (); |
|
32
|
|
|
|
|
49
|
|
|
32
|
|
|
|
|
595
|
|
7
|
32
|
|
|
32
|
|
205
|
use Fcntl; |
|
32
|
|
|
|
|
78
|
|
|
32
|
|
|
|
|
12362
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
filter 'CODE' => \&parse; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub parse { |
13
|
6
|
|
|
6
|
0
|
14
|
my ($subref, $ddp) = @_; |
14
|
6
|
100
|
|
|
|
19
|
my $string = $ddp->deparse ? _deparse($subref, $ddp) : 'sub { ... }'; |
15
|
6
|
|
|
|
|
21
|
return $ddp->maybe_colorize($string, 'code'); |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
####################################### |
19
|
|
|
|
|
|
|
### Private auxiliary helpers below ### |
20
|
|
|
|
|
|
|
####################################### |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _deparse { |
23
|
2
|
|
|
2
|
|
4
|
my ($subref, $ddp) = @_; |
24
|
2
|
|
|
|
|
13
|
require B::Deparse; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# FIXME: line below breaks encapsulation on Data::Printer::Object |
27
|
2
|
|
|
|
|
5
|
my $i = $ddp->{indent} + $ddp->{_array_padding}; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
8
|
my $deparseopts = ["-sCi${i}v'Useless const omitted'"]; |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
1363
|
my $sub = 'sub ' . B::Deparse->new($deparseopts)->coderef2text($subref); |
32
|
2
|
|
|
|
|
20
|
my $pad = $ddp->newline; |
33
|
2
|
|
|
|
|
10
|
$sub =~ s/\n/$pad/gse; |
|
4
|
|
|
|
|
11
|
|
34
|
2
|
|
|
|
|
8
|
return $sub; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |