line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sub::Inspector; |
2
|
2
|
|
|
2
|
|
87607
|
use 5.008_001; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
78
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
101
|
|
5
|
2
|
|
|
2
|
|
23
|
use B (); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
25
|
|
6
|
2
|
|
|
2
|
|
8
|
use Carp (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
58
|
|
7
|
|
|
|
|
|
|
our @CARP_NOT; |
8
|
2
|
|
|
2
|
|
1859
|
use attributes; |
|
2
|
|
|
|
|
2814
|
|
|
2
|
|
|
|
|
12
|
|
9
|
2
|
|
|
2
|
|
2148
|
use Data::Dumper (); |
|
2
|
|
|
|
|
22094
|
|
|
2
|
|
|
|
|
49
|
|
10
|
2
|
|
|
2
|
|
2914
|
use Data::Dump::Streamer (); |
|
2
|
|
|
|
|
260606
|
|
|
2
|
|
|
|
|
940
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
7
|
|
|
7
|
0
|
9590
|
my ($class, $code) = @_; |
16
|
7
|
100
|
|
|
|
31
|
_throw($code) unless ref($code) eq 'CODE'; |
17
|
6
|
|
|
|
|
25
|
bless +{ code => $code }, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
1
|
1328
|
sub file { B::svref_2object(_code(@_))->GV->FILE } |
21
|
3
|
|
|
3
|
1
|
1957
|
sub line { B::svref_2object(_code(@_))->GV->LINE } |
22
|
3
|
|
|
3
|
1
|
1783
|
sub name { B::svref_2object(_code(@_))->GV->NAME } |
23
|
|
|
|
|
|
|
|
24
|
10
|
|
|
10
|
1
|
1309
|
sub proto { B::svref_2object(_code(@_))->PV } |
25
|
5
|
|
|
5
|
0
|
1950
|
sub prototype { proto(@_) } |
26
|
|
|
|
|
|
|
|
27
|
14
|
|
|
14
|
1
|
3131
|
sub attrs { attributes::get(_code(@_)) } |
28
|
7
|
|
|
7
|
0
|
4556
|
sub attributes { attrs(@_) } |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
1
|
0
|
sub dump { Data::Dump::Streamer::Dumper(_code(@_)) } |
31
|
0
|
|
|
0
|
0
|
0
|
sub as_string { Sub::Inspector::dump(@_) } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _throw { |
34
|
8
|
|
|
8
|
|
12
|
local $Data::Dumper::Indent = 1; |
35
|
8
|
|
|
|
|
13
|
local $Data::Dumper::Terse = 1; |
36
|
8
|
|
|
|
|
20
|
local @CARP_NOT = (__PACKAGE__); |
37
|
8
|
|
|
|
|
33
|
Carp::croak "argument isn't a subroutine reference: " . Data::Dumper::Dumper($_[0]); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _code { |
41
|
33
|
|
|
33
|
|
52
|
my ($stuff, $arg) = @_; |
42
|
|
|
|
|
|
|
# instance method |
43
|
33
|
100
|
33
|
|
|
176
|
if (ref($stuff) eq __PACKAGE__) { |
|
|
50
|
|
|
|
|
|
44
|
13
|
|
|
|
|
112
|
return $stuff->{code}; |
45
|
|
|
|
|
|
|
# calss method |
46
|
|
|
|
|
|
|
} elsif (defined($stuff) && $stuff eq __PACKAGE__) { |
47
|
20
|
100
|
|
|
|
105
|
return $arg if (ref($arg) eq 'CODE'); |
48
|
7
|
|
|
|
|
15
|
_throw($arg); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
__END__ |