line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Aspect::Pointcut::Cflow; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1768
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
6
|
1
|
|
|
1
|
|
404
|
use Aspect::AdviceContext; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
9
|
use base 'Aspect::Pointcut'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
507
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
3
|
|
|
3
|
0
|
7
|
my $self = shift; |
12
|
3
|
50
|
|
|
|
14
|
carp 'Cflow must be created with 2 parameters' unless @_ == 2; |
13
|
3
|
|
|
|
|
281
|
$self->{runtime_context_key} = shift; |
14
|
3
|
|
|
|
|
14
|
$self->{spec} = shift; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub match_run { |
18
|
4
|
|
|
4
|
0
|
31
|
my ($self, $sub_name, $runtime_context) = @_; |
19
|
4
|
|
|
|
|
14
|
my $caller_info = $self->find_caller; |
20
|
4
|
100
|
|
|
|
13
|
return 0 unless $caller_info; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
29
|
my $advice_context = Aspect::AdviceContext->new( |
23
|
|
|
|
|
|
|
sub_name => $caller_info->{sub_name}, |
24
|
|
|
|
|
|
|
pointcut => $self, |
25
|
|
|
|
|
|
|
params => $caller_info->{params}, |
26
|
|
|
|
|
|
|
); |
27
|
3
|
|
|
|
|
8
|
$runtime_context->{$self->{runtime_context_key}} = $advice_context; |
28
|
3
|
|
|
|
|
14
|
return 1; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub find_caller { |
32
|
4
|
|
|
4
|
0
|
8
|
my $self = shift; |
33
|
4
|
|
|
|
|
6
|
my $level = 2; |
34
|
4
|
|
|
|
|
5
|
my $caller_info; |
35
|
4
|
|
|
|
|
6
|
while (1) { |
36
|
23
|
|
|
|
|
44
|
$caller_info = $self->caller_info($level++); |
37
|
|
|
|
|
|
|
last if |
38
|
23
|
100
|
100
|
|
|
261
|
!$caller_info || |
39
|
|
|
|
|
|
|
$self->match($self->{spec}, $caller_info->{sub_name}); |
40
|
|
|
|
|
|
|
} |
41
|
4
|
|
|
|
|
11
|
return $caller_info; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub caller_info { |
45
|
23
|
|
|
23
|
0
|
21
|
my ($self, $level) = @_; |
46
|
|
|
|
|
|
|
package DB; |
47
|
23
|
|
|
|
|
17
|
my %call_info; |
48
|
23
|
|
|
|
|
134
|
@call_info {qw(calling_package sub_name has_params)} = |
49
|
|
|
|
|
|
|
(CORE::caller($level))[0, 3, 4]; |
50
|
23
|
100
|
|
|
|
132
|
return defined $call_info{calling_package}? |
|
|
100
|
|
|
|
|
|
51
|
|
|
|
|
|
|
{%call_info, params => [$call_info{has_params}? @DB::args: ()]}: 0; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |