line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Aspect::Library::Memoize; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2314
|
use 5.008002; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
87
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
79
|
|
5
|
2
|
|
|
2
|
|
20
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
78
|
|
6
|
2
|
|
|
2
|
|
2408
|
use Memoize 1.01 (); |
|
2
|
|
|
|
|
5688
|
|
|
2
|
|
|
|
|
55
|
|
7
|
2
|
|
|
2
|
|
1877
|
use Aspect::Modular 1.00 (); |
|
2
|
|
|
|
|
7167
|
|
|
2
|
|
|
|
|
56
|
|
8
|
2
|
|
|
2
|
|
907
|
use Aspect::Advice::Before (); |
|
2
|
|
|
|
|
10764
|
|
|
2
|
|
|
|
|
669
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
11
|
|
|
|
|
|
|
our @ISA = 'Aspect::Modular'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub get_advice { |
14
|
2
|
|
|
2
|
0
|
1896
|
my %WRAPPER = (); |
15
|
|
|
|
|
|
|
Aspect::Advice::Before->new( |
16
|
|
|
|
|
|
|
lexical => $_[0]->lexical, |
17
|
|
|
|
|
|
|
pointcut => $_[1], |
18
|
|
|
|
|
|
|
code => sub { |
19
|
8
|
|
|
8
|
|
283347
|
my $name = $_->sub_name; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Would be difficult if Memoize did not have INSTALL => undef option |
22
|
8
|
|
66
|
|
|
47
|
$WRAPPER{$name} ||= Memoize::memoize( |
23
|
|
|
|
|
|
|
$_->original, |
24
|
|
|
|
|
|
|
INSTALL => undef, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Pass through to the memoised function, using the |
28
|
|
|
|
|
|
|
# same wantarray context as the original call. |
29
|
8
|
50
|
|
|
|
6597
|
if ( $_->wantarray ) { |
|
|
50
|
|
|
|
|
|
30
|
0
|
|
|
|
|
0
|
my @rv = $WRAPPER{$name}->($_->args); |
31
|
0
|
|
|
|
|
0
|
$_->return_value(@rv); |
32
|
|
|
|
|
|
|
} elsif ( defined $_->wantarray ) { |
33
|
8
|
|
|
|
|
28
|
my $rv = $WRAPPER{$name}->($_->args); |
34
|
8
|
|
|
|
|
453
|
$_->return_value($rv); |
35
|
|
|
|
|
|
|
} else { |
36
|
0
|
|
|
|
|
|
$WRAPPER{$name}->($_->args); |
37
|
0
|
|
|
|
|
|
$_->return_value; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
}, |
40
|
2
|
|
|
|
|
41
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |