| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Aspect::Pointcut::Call; |
|
2
|
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
142
|
use strict; |
|
|
26
|
|
|
|
|
49
|
|
|
|
26
|
|
|
|
|
814
|
|
|
4
|
26
|
|
|
26
|
|
137
|
use Carp (); |
|
|
26
|
|
|
|
|
54
|
|
|
|
26
|
|
|
|
|
457
|
|
|
5
|
26
|
|
|
26
|
|
139
|
use Params::Util (); |
|
|
26
|
|
|
|
|
45
|
|
|
|
26
|
|
|
|
|
384
|
|
|
6
|
26
|
|
|
26
|
|
134
|
use Aspect::Pointcut (); |
|
|
26
|
|
|
|
|
46
|
|
|
|
26
|
|
|
|
|
1178
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.04'; |
|
9
|
|
|
|
|
|
|
our @ISA = 'Aspect::Pointcut'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
26
|
|
|
26
|
|
143
|
use constant ORIGINAL => 0; |
|
|
26
|
|
|
|
|
47
|
|
|
|
26
|
|
|
|
|
1750
|
|
|
12
|
26
|
|
|
26
|
|
126
|
use constant COMPILE_CODE => 1; |
|
|
26
|
|
|
|
|
49
|
|
|
|
26
|
|
|
|
|
1109
|
|
|
13
|
26
|
|
|
26
|
|
175
|
use constant RUNTIME_CODE => 2; |
|
|
26
|
|
|
|
|
40
|
|
|
|
26
|
|
|
|
|
1036
|
|
|
14
|
26
|
|
|
26
|
|
131
|
use constant COMPILE_EVAL => 3; |
|
|
26
|
|
|
|
|
48
|
|
|
|
26
|
|
|
|
|
1039
|
|
|
15
|
26
|
|
|
26
|
|
128
|
use constant RUNTIME_EVAL => 4; |
|
|
26
|
|
|
|
|
50
|
|
|
|
26
|
|
|
|
|
14038
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
###################################################################### |
|
22
|
|
|
|
|
|
|
# Constructor Methods |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# The constructor stores three values. |
|
25
|
|
|
|
|
|
|
# $self->[0] is the original specification provided to the constructor |
|
26
|
|
|
|
|
|
|
# $self->[1] is a function form of the condition that has a sub name passed |
|
27
|
|
|
|
|
|
|
# in and returns true if matching or false if not. |
|
28
|
|
|
|
|
|
|
# $self->[2] is a function form of the condition that has the sub name set as |
|
29
|
|
|
|
|
|
|
# the topic variable. |
|
30
|
|
|
|
|
|
|
# $self->[3] is a function form of the condition that has the join point object |
|
31
|
|
|
|
|
|
|
# set as the topic variable. |
|
32
|
|
|
|
|
|
|
# $self->[4] is either a string Perl fragment that can be eval'ed with $_ set |
|
33
|
|
|
|
|
|
|
# as the sub name, or a function that can be called with $_ set as |
|
34
|
|
|
|
|
|
|
# the sub name. |
|
35
|
|
|
|
|
|
|
# $self->[5] is either a string Perl fragment that can be eval'ed with $_ set |
|
36
|
|
|
|
|
|
|
# as the join point variable, or a function that can be called with |
|
37
|
|
|
|
|
|
|
# $_ set as the join point variable. |
|
38
|
|
|
|
|
|
|
# All of 1-5 return true of the condition matches, or false if not. |
|
39
|
|
|
|
|
|
|
sub new { |
|
40
|
197
|
|
|
197
|
1
|
1538
|
my $class = shift; |
|
41
|
197
|
|
|
|
|
414
|
my $spec = shift; |
|
42
|
197
|
100
|
|
|
|
1179
|
if ( Params::Util::_STRING($spec) ) { |
|
43
|
142
|
|
|
|
|
697
|
my $string = '"' . quotemeta($spec) . '"'; |
|
44
|
142
|
|
|
|
|
13978
|
return bless [ |
|
45
|
|
|
|
|
|
|
$spec, |
|
46
|
|
|
|
|
|
|
eval "sub () { \$_[0] eq $string }", |
|
47
|
|
|
|
|
|
|
eval "sub () { \$_ eq $string }", |
|
48
|
|
|
|
|
|
|
eval "sub () { \$Aspect::POINT->{sub_name} eq $string }", |
|
49
|
|
|
|
|
|
|
"\$_ eq $string", |
|
50
|
|
|
|
|
|
|
"\$Aspect::POINT->{sub_name} eq $string", |
|
51
|
|
|
|
|
|
|
], $class; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
55
|
100
|
|
|
|
696
|
if ( Params::Util::_CODELIKE($spec) ) { |
|
54
|
|
|
|
|
|
|
return bless [ |
|
55
|
|
|
|
|
|
|
$spec, |
|
56
|
|
|
|
|
|
|
$spec, |
|
57
|
0
|
|
|
0
|
|
0
|
sub { $spec->($_) }, |
|
58
|
0
|
|
|
0
|
|
0
|
sub { $spec->($Aspect::POINT->{sub_name}) }, |
|
59
|
2
|
|
|
2
|
|
362
|
sub { $spec->($_) }, |
|
60
|
2
|
|
|
2
|
|
379
|
sub { $spec->($Aspect::POINT->{sub_name}) }, |
|
61
|
1
|
|
|
|
|
12
|
], $class; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
54
|
50
|
|
|
|
27909
|
if ( Params::Util::_REGEX($spec) ) { |
|
64
|
|
|
|
|
|
|
# Special case serialisation of regexs |
|
65
|
|
|
|
|
|
|
# In Perl 5.13.6 the format of a serialised regex changed |
|
66
|
|
|
|
|
|
|
# incompatibly. Worse, the optimisation trick that worked |
|
67
|
|
|
|
|
|
|
# before no longer works after, as there are now modifiers |
|
68
|
|
|
|
|
|
|
# that are ONLY value inside and can't be moved to the end. |
|
69
|
|
|
|
|
|
|
# So we first serialise to a form that will be valid code |
|
70
|
|
|
|
|
|
|
# under the new system, and then do the replace that will |
|
71
|
|
|
|
|
|
|
# only match (and only be valid) under the old system. |
|
72
|
54
|
|
|
|
|
201
|
my $regex = "/$spec/"; |
|
73
|
54
|
|
|
|
|
266
|
$regex =~ s|^/\(\?([xism]*)-[xism]*:(.*)\)/\z|/$2/$1|s; |
|
74
|
54
|
|
|
|
|
6426
|
return bless [ |
|
75
|
|
|
|
|
|
|
$spec, |
|
76
|
|
|
|
|
|
|
eval "sub () { \$_[0] =~ $regex }", |
|
77
|
|
|
|
|
|
|
eval "sub () { $regex }", |
|
78
|
|
|
|
|
|
|
eval "sub () { \$Aspect::POINT->{sub_name} =~ $regex }", |
|
79
|
|
|
|
|
|
|
$regex, |
|
80
|
|
|
|
|
|
|
"\$Aspect::POINT->{sub_name} =~ $regex", |
|
81
|
|
|
|
|
|
|
], $class; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
0
|
|
|
|
|
0
|
Carp::croak("Invalid function call specification"); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
###################################################################### |
|
91
|
|
|
|
|
|
|
# Weaving Methods |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub match_runtime { |
|
94
|
57
|
|
|
57
|
0
|
252
|
return 0; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Call pointcuts are the primary thing used at weave time |
|
98
|
|
|
|
|
|
|
sub curry_weave { |
|
99
|
166
|
|
|
166
|
1
|
570
|
return $_[0]; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Call pointcuts curry away to null, because they are the basis |
|
103
|
|
|
|
|
|
|
# for which methods to hook in the first place. Any method called |
|
104
|
|
|
|
|
|
|
# at run-time has already been checked. |
|
105
|
|
|
|
|
|
|
sub curry_runtime { |
|
106
|
181
|
|
|
181
|
1
|
1945
|
return; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# Compiled string form of the pointcut |
|
110
|
|
|
|
|
|
|
sub compile_weave { |
|
111
|
|
|
|
|
|
|
$_[0]->[4]; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# Compiled string form of the pointcut |
|
115
|
|
|
|
|
|
|
sub compile_runtime { |
|
116
|
|
|
|
|
|
|
$_[0]->[5]; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
###################################################################### |
|
124
|
|
|
|
|
|
|
# Optional XS Acceleration |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
BEGIN { |
|
127
|
26
|
|
|
26
|
|
67
|
local $@; |
|
128
|
26
|
|
|
26
|
|
14222
|
eval <<'END_PERL'; |
|
|
26
|
|
|
|
|
165
|
|
|
|
26
|
|
|
|
|
603
|
|
|
|
26
|
|
|
|
|
240
|
|
|
129
|
|
|
|
|
|
|
use Class::XSAccessor::Array 1.08 { |
|
130
|
|
|
|
|
|
|
replace => 1, |
|
131
|
|
|
|
|
|
|
getters => { |
|
132
|
|
|
|
|
|
|
'compile_weave' => 4, |
|
133
|
|
|
|
|
|
|
'compile_runtime' => 5, |
|
134
|
|
|
|
|
|
|
}, |
|
135
|
|
|
|
|
|
|
}; |
|
136
|
|
|
|
|
|
|
END_PERL |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
__END__ |