Aspect/Modular.pm

filter: Statementstmt 88.5% 31 / 35 Branchbran 66.6% 4 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 3 totaltotal 74.1% 43 / 58 SCAR 16.5
CC
5
Cov
80%
get_advice
6.0
new
4.1
BEGIN
1.0
CRAP 5.2
« Aspect/Advice.pm ↑ Summary Aspect/Pointcut/Throwing.pm »
1 package Aspect::Modular;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use Aspect::Library ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION = '0.97_06';
8 4 our @ISA = 'Aspect::Library';
9  
10 sub new {
11 7 ▶ my $class = shift;
Subroutine new: called CC=4 SCAR=14.2
Pod undocumented
12 7 my $self = bless { @_ }, $class;
13  
14 # Generate the appropriate advice
15 $self->{advice} = [
16 7 $self->get_advice( $self->args )
17 ];
18  
19 # Warn if the aspect is supposed to be permanent,
20 # but the advice isn't created as permanent.
21 7 ▶ if ( $self->lexical ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->lexical) { } 3 4 7
22 3 ▶ if ( grep { not $_->lexical } @{$self->{advice}} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {not $_->lexical;} @{$$self{"advice"};}) 0 3 3
23 0 warn("$class creates lexical advice for global aspects");
24 }
25 } else {
26 4 ▶ if ( grep { $_->lexical } @{$self->{advice}} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_->lexical;} @{$$self{"advice"};}) 0 4 4
27 0 warn("$class creates global advice for lexical aspects");
28 }
29 }
30  
31 7 return $self;
32 }
33  
34 sub args {
35 7 ▶ @{$_[0]->{args}};
Subroutine args: called CC=1 SCAR=0.0
Pod undocumented
36 }
37  
38 sub lexical {
39 $_[0]->{lexical};
40 }
41  
42 sub get_advice {
43 0 ▶ my $class = ref $_[0] || $_[0];
Subroutine get_advice: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/3
ref $_[0] || $_[0]
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table0%0/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
44 0 die("Method 'get_advice' is not implemented by class '$class'");
45 }
46  
47  
48  
49  
50  
51 ######################################################################
52 # Back Compatibility
53  
54 BEGIN {
55 4 ▶ *params = *args;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 }
57  
58  
59  
60  
61  
62 ######################################################################
63 # Optional XS Acceleration
64  
65 BEGIN {
66 4 ▶ local $@;
Subroutine BEGIN: called CC=1 SCAR=0.0
67 4 ▶ eval <<'END_PERL';
Subroutine BEGIN: called CC=1 SCAR=0.0
68 use Class::XSAccessor 1.08 {
69 replace => 1,
70 getters => {
71 'lexical' => 'lexical',
72 },
73 };
74 END_PERL
75 }
76  
77 4 1;
78  
79 __END__
« Aspect/Advice.pm ↑ Summary Aspect/Pointcut/Throwing.pm »