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