line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Aspect::Pointcut::Cflow; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
79
|
use strict; |
|
21
|
|
|
|
|
25
|
|
|
21
|
|
|
|
|
533
|
|
4
|
21
|
|
|
21
|
|
72
|
use warnings; |
|
21
|
|
|
|
|
23
|
|
|
21
|
|
|
|
|
496
|
|
5
|
21
|
|
|
21
|
|
81
|
use Carp (); |
|
21
|
|
|
|
|
25
|
|
|
21
|
|
|
|
|
237
|
|
6
|
21
|
|
|
21
|
|
67
|
use Params::Util (); |
|
21
|
|
|
|
|
23
|
|
|
21
|
|
|
|
|
231
|
|
7
|
21
|
|
|
21
|
|
68
|
use Aspect::Pointcut (); |
|
21
|
|
|
|
|
22
|
|
|
21
|
|
|
|
|
264
|
|
8
|
21
|
|
|
21
|
|
80
|
use Aspect::Pointcut::Call (); |
|
21
|
|
|
|
|
24
|
|
|
21
|
|
|
|
|
285
|
|
9
|
21
|
|
|
21
|
|
7531
|
use Aspect::Point::Static (); |
|
21
|
|
|
|
|
42
|
|
|
21
|
|
|
|
|
952
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.97_06'; |
12
|
|
|
|
|
|
|
our @ISA = 'Aspect::Pointcut'; |
13
|
|
|
|
|
|
|
|
14
|
21
|
|
|
21
|
|
116
|
use constant KEY => 0; |
|
21
|
|
|
|
|
23
|
|
|
21
|
|
|
|
|
1198
|
|
15
|
21
|
|
|
21
|
|
84
|
use constant SPEC => 2; |
|
21
|
|
|
|
|
24
|
|
|
21
|
|
|
|
|
7121
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
###################################################################### |
22
|
|
|
|
|
|
|
# Constructor Methods |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
9
|
|
|
9
|
1
|
22
|
my $class = shift; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Check and default the cflow key |
28
|
9
|
100
|
|
|
|
52
|
my $key = @_ > 1 ? shift : 'enclosing'; |
29
|
9
|
50
|
|
|
|
224
|
unless ( Params::Util::_IDENTIFIER($key) ) { |
30
|
0
|
|
|
|
|
0
|
Carp::croak('Invalid runtime context key'); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Generate it via call |
34
|
9
|
|
|
|
|
154
|
my $call = Aspect::Pointcut::Call->new(shift); |
35
|
9
|
|
|
|
|
459
|
return bless [ $key, @$call ], $class; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
###################################################################### |
43
|
|
|
|
|
|
|
# Weaving Methods |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# The cflow pointcut is currently of no value at weave time, because it is |
46
|
|
|
|
|
|
|
# actually implemented as something closer to cflowbelow. |
47
|
|
|
|
|
|
|
sub curry_weave { |
48
|
9
|
|
|
9
|
1
|
28
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# The cflow pointcuts do not curry at all. |
52
|
|
|
|
|
|
|
# So they don't need to clone, and can be used directly. |
53
|
|
|
|
|
|
|
sub curry_runtime { |
54
|
9
|
|
|
9
|
1
|
31
|
return $_[0]; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
###################################################################### |
62
|
|
|
|
|
|
|
# Runtime Methods |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub compile_runtime { |
65
|
9
|
|
|
9
|
1
|
15
|
my $self = shift; |
66
|
|
|
|
|
|
|
return sub { |
67
|
23
|
|
|
23
|
|
33
|
my $level = 2; |
68
|
23
|
|
|
|
|
28
|
my $caller = undef; |
69
|
23
|
|
|
|
|
65
|
while ( my $cc = caller_info($level++) ) { |
70
|
58
|
100
|
|
|
|
1192
|
next unless $self->[SPEC]->( $cc->{sub_name} ); |
71
|
11
|
|
|
|
|
19
|
$caller = $cc; |
72
|
11
|
|
|
|
|
18
|
last; |
73
|
|
|
|
|
|
|
} |
74
|
23
|
100
|
|
|
|
453
|
return 0 unless $caller; |
75
|
|
|
|
|
|
|
my $context = bless { |
76
|
|
|
|
|
|
|
sub_name => $caller->{sub_name}, |
77
|
|
|
|
|
|
|
pointcut => $_->{pointcut}, |
78
|
|
|
|
|
|
|
args => $caller->{args}, |
79
|
11
|
|
|
|
|
86
|
}, 'Aspect::Point::Static'; |
80
|
11
|
|
|
|
|
37
|
$_->{$self->[KEY]} = $context; |
81
|
11
|
|
|
|
|
197
|
return 1; |
82
|
9
|
|
|
|
|
64
|
}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub caller_info { |
86
|
70
|
|
|
70
|
0
|
63
|
my $level = shift; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
package DB; |
89
|
|
|
|
|
|
|
|
90
|
70
|
|
|
|
|
55
|
my %call_info; |
91
|
70
|
|
|
|
|
485
|
@call_info{ qw( |
92
|
|
|
|
|
|
|
calling_package |
93
|
|
|
|
|
|
|
sub_name |
94
|
|
|
|
|
|
|
has_params |
95
|
|
|
|
|
|
|
) } = (CORE::caller($level))[0, 3, 4]; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
return defined $call_info{calling_package} |
98
|
|
|
|
|
|
|
? { |
99
|
|
|
|
|
|
|
%call_info, |
100
|
|
|
|
|
|
|
args => [ |
101
|
70
|
100
|
|
|
|
492
|
$call_info{has_params} ? @DB::args : () |
|
|
100
|
|
|
|
|
|
102
|
|
|
|
|
|
|
], |
103
|
|
|
|
|
|
|
} : 0; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |