line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Aspect::Library::Singleton; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2538
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
83
|
|
4
|
2
|
|
|
2
|
|
564
|
use Aspect::Modular (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
32
|
|
5
|
2
|
|
|
2
|
|
13
|
use Aspect::Advice::Before (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
37
|
|
6
|
2
|
|
|
2
|
|
13
|
use Aspect::Pointcut::Call (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
466
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.04'; |
9
|
|
|
|
|
|
|
our @ISA = 'Aspect::Modular'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %CACHE = (); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub get_advice { |
14
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
15
|
|
|
|
|
|
|
Aspect::Advice::Around->new( |
16
|
|
|
|
|
|
|
lexical => $self->lexical, |
17
|
|
|
|
|
|
|
pointcut => Aspect::Pointcut::Call->new(shift), |
18
|
|
|
|
|
|
|
code => sub { |
19
|
2
|
|
|
2
|
|
38
|
my $class = $_->self; |
20
|
2
|
|
33
|
|
|
21
|
$class = ref $class || $class; |
21
|
2
|
100
|
|
|
|
6
|
if ( exists $CACHE{$class} ) { |
22
|
1
|
|
|
|
|
4
|
$_->return_value($CACHE{$class}); |
23
|
|
|
|
|
|
|
} else { |
24
|
1
|
|
|
|
|
6
|
$_->proceed; |
25
|
1
|
|
|
|
|
4
|
$CACHE{$class} = $_->return_value; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
}, |
28
|
2
|
|
|
|
|
24
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |