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