line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Chitin::SubroutineLocation; |
2
|
|
|
|
|
|
|
|
3
|
34
|
|
|
34
|
|
893
|
use strict; |
|
34
|
|
|
|
|
693
|
|
|
34
|
|
|
|
|
1433
|
|
4
|
34
|
|
|
34
|
|
1423
|
use warnings; |
|
34
|
|
|
|
|
53
|
|
|
34
|
|
|
|
|
1833
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.12'; # TRIAL |
7
|
|
|
|
|
|
|
|
8
|
34
|
|
|
34
|
|
845
|
use Carp; |
|
34
|
|
|
|
|
822
|
|
|
34
|
|
|
|
|
3460
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my @properties = qw(package subroutine line filename end code source source_line); |
11
|
|
|
|
|
|
|
foreach my $prop ( @properties ) { |
12
|
0
|
|
|
0
|
|
|
my $sub = sub { shift->{$prop} }; |
13
|
34
|
|
|
34
|
|
907
|
no strict 'refs'; |
|
34
|
|
|
|
|
1321
|
|
|
34
|
|
|
|
|
7270
|
|
14
|
|
|
|
|
|
|
*$prop = $sub; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
0
|
|
|
0
|
0
|
|
my($class, %props) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
foreach my $prop ( @properties ) { |
21
|
0
|
0
|
|
|
|
|
Carp::croak("$prop is a required property") unless (exists $props{$prop}); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
return bless \%props, $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new_from_db_sub { |
28
|
0
|
|
|
0
|
0
|
|
my($class, $subname) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
0
|
|
|
|
return () unless (defined($subname) and $DB::sub{$subname}); |
31
|
0
|
|
|
|
|
|
my($filename, $line, $end) = $DB::sub{$subname} =~ m/(.*):(\d+)-(\d+)$/; |
32
|
0
|
|
|
|
|
|
my($source, $source_line) = $filename =~ m/\[(.*):(\d+)\]$/; |
33
|
0
|
|
|
|
|
|
my $glob = do { |
34
|
34
|
|
|
34
|
|
778
|
no strict 'refs'; |
|
34
|
|
|
|
|
60
|
|
|
34
|
|
|
|
|
5750
|
|
35
|
0
|
|
|
|
|
|
\*$subname; |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
return Devel::Chitin::SubroutineLocation->new( |
38
|
|
|
|
|
|
|
filename => $filename, |
39
|
|
|
|
|
|
|
line => $line, |
40
|
|
|
|
|
|
|
end => $end, |
41
|
|
|
|
|
|
|
source => $source || $filename, |
42
|
|
|
|
|
|
|
source_line => $source_line || $line, |
43
|
|
|
|
|
|
|
subroutine => *$glob{NAME}, |
44
|
|
|
|
|
|
|
package => *$glob{PACKAGE}, |
45
|
0
|
|
0
|
|
|
|
code => *$glob{CODE} ); |
|
|
|
0
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |