| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Devel::Spy::_obj; |
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
25
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
30
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
## WARNING!!!! HEY!! Read this! |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# This package should be as spotless as possible. Don't define or |
|
8
|
|
|
|
|
|
|
# import any functions here because then they'll shadow that if it's |
|
9
|
|
|
|
|
|
|
# also defined in the objects that are being wrapped. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Seriously. Make recursion fatal. I hit this alot when writing this |
|
12
|
|
|
|
|
|
|
# kind of code and it helps to have a backstop. |
|
13
|
1
|
|
|
1
|
|
4
|
use warnings FATAL => 'all'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
13
|
use overload (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
15
|
|
|
16
|
1
|
|
|
1
|
|
5
|
use Sub::Name (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
27
|
|
|
17
|
1
|
|
|
1
|
|
733
|
use UNIVERSAL::ref; |
|
|
1
|
|
|
|
|
182481
|
|
|
|
1
|
|
|
|
|
9
|
|
|
18
|
1
|
|
|
1
|
|
52
|
use Devel::Spy::Util (); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
19
|
|
|
19
|
1
|
|
|
1
|
|
7
|
use Devel::Spy::_constants; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
30
|
|
|
20
|
1
|
|
|
1
|
|
1129
|
use Devel::Spy::_overload; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
73
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Called by UNIVERSAL::ref. |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
# TODO: what if my called object also would like ->ref invoked as a method? |
|
25
|
|
|
|
|
|
|
sub ref { |
|
26
|
0
|
|
|
0
|
0
|
0
|
return CORE::ref( $_[Devel::Spy::SELF][Devel::Spy::UNTIED_PAYLOAD] ); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Do all the proxy work for methods (other than isa and can) here. |
|
30
|
|
|
|
|
|
|
# |
|
31
|
|
|
|
|
|
|
# TODO: what if my wrapped object needs an AUTOLOAD too? |
|
32
|
1
|
|
|
1
|
|
7
|
use vars '$AUTOLOAD'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
447
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
35
|
1
|
|
|
1
|
|
14
|
my $method = $AUTOLOAD; |
|
36
|
1
|
|
|
|
|
6
|
$method =~ s/^Devel::Spy::_obj:://; |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
2
|
my $self = shift @_; |
|
39
|
1
|
|
|
|
|
22
|
my $class = Scalar::Util::blessed( $self->[Devel::Spy::UNTIED_PAYLOAD] ); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Redispatch and log, maintaining context. |
|
42
|
1
|
50
|
|
|
|
5
|
if (wantarray) { |
|
|
|
50
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Log before. |
|
45
|
0
|
|
|
|
|
0
|
my $followup = $self->[Devel::Spy::CODE]->( " \@->$method(" |
|
46
|
|
|
|
|
|
|
. join( ',', map overload::StrVal($_), @_ ) |
|
47
|
|
|
|
|
|
|
. ')' ); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Redispatch. |
|
50
|
0
|
|
|
|
|
0
|
my @results = $self->[Devel::Spy::UNTIED_PAYLOAD]->$method(@_); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Log after. |
|
53
|
0
|
|
|
|
|
0
|
$followup = $followup->( |
|
54
|
|
|
|
|
|
|
' ->(' . join( ',', map overload::StrVal($_), @results ) . ')' ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
0
|
return @results; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
elsif ( defined wantarray ) { |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Log before. |
|
61
|
1
|
|
|
|
|
8
|
my $followup = $self->[Devel::Spy::CODE]->( " \$->$method(" |
|
62
|
|
|
|
|
|
|
. join( ',', map overload::StrVal($_), @_ ) |
|
63
|
|
|
|
|
|
|
. ')' ); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Redispatch. |
|
66
|
1
|
|
|
|
|
4
|
my $result = $self->[Devel::Spy::UNTIED_PAYLOAD]->$method(@_); |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Log after. |
|
69
|
1
|
|
|
|
|
7
|
$followup = $followup->( ' ->' . overload::StrVal($result) ); |
|
70
|
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
8
|
return Devel::Spy->new( $result, $followup ); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
else { |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Log before. |
|
76
|
0
|
|
|
|
|
|
my $followup = $self->[Devel::Spy::CODE]->( " V->$method(" |
|
77
|
|
|
|
|
|
|
. join( ',', map overload::StrVal($_), @_ ) |
|
78
|
|
|
|
|
|
|
. ')' ); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Redispatch. |
|
81
|
0
|
|
|
|
|
|
$self->[Devel::Spy::UNTIED_PAYLOAD]->$method(@_); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Log after? |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# TODO: what if my called object should accept this DESTROY call? |
|
90
|
0
|
|
|
0
|
|
|
sub DESTROY { } |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |