| 1 | package Aspect::Library::Singleton; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 2 | ▶ | use Aspect::Modular (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 2 | ▶ | use Aspect::Advice::Before (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 2 | ▶ | use Aspect::Pointcut::Call (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 2 | our $VERSION = '0.97_06'; | |||||||||||||||||||
| 10 | 2 | our @ISA = 'Aspect::Modular'; | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 2 | my %CACHE = (); | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | sub get_advice { | ||||||||||||||||||||
| 15 | 2 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
get_advice: called CC=1 SCAR=0.1
Pod
undocumented
| |||||||||||||||||||||
| 16 | Aspect::Advice::Around->new( | ||||||||||||||||||||
| 17 | lexical => $self->lexical, | ||||||||||||||||||||
| 18 | pointcut => Aspect::Pointcut::Call->new(shift), | ||||||||||||||||||||
| 19 | code => sub { | ||||||||||||||||||||
| 20 | 2 | ▶ | my $class = $_->self; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.2
| |||||||||||||||||||||
| 21 | 2 | ▶ | $class = ref $class || $class; | ||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 22 | 2 | ▶ | if ( exists $CACHE{$class} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | 1 | $_->return_value($CACHE{$class}); | |||||||||||||||||||
| 24 | } else { | ||||||||||||||||||||
| 25 | 1 | $_->proceed; | |||||||||||||||||||
| 26 | 1 | ▶ | unless ( $_->exception ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | 1 | $CACHE{$class} = $_->return_value; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | }, | ||||||||||||||||||||
| 31 | 2 | ); | |||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 2 | 1; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | __END__ | ||||||||||||||||||||