MixinFactory/InsideOutAttr.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 87.1% 34 / 39 CC 5 SCAR 8.0
CC
5
Cov
90%
inside_out
3.1
import
3.0
BEGIN
1.0
CRAP 2.2
« MixinFactory.pm ↑ Summary MixinFactory/HasAFactory.pm »
1 package Class::MixinFactory::InsideOutAttr;
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 ########################################################################
6  
7 16 ▶sub import {
Subroutine import: called CC=3 SCAR=11.0
8 16 my $methodmaker = shift;
9 16 my $target_class = ( caller )[0];
10 8 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 16 foreach my $attr ( @_ ) {
12 32 ▶ *{ $target_class . '::' . $attr } = sub { inside_out( $attr, @_ ) }
Subroutine __ANON__: called CC=1 SCAR=0.0
13 32 }
14 16 defined *{ $target_class . '::' . 'DESTROY' }{CODE}
15 16 ▶ or *{ $target_class . '::' . 'DESTROY' } = \&destroy;
Branch: 1 branch
BranchTrueFalseTotal
defined *{$target_class . '::' . "DESTROY";}{"CODE"} or *{$target_class . '::' . "DESTROY";} = \&Class::MixinFactory::InsideOutAttr::destroy 0 16 16
16 }
17  
18 8 my %inside_out;
19  
20 276 ▶sub inside_out {
Subroutine inside_out: called CC=3 SCAR=11.2
Pod undocumented
21 276 my $callee = shift;
22 276 my $key = shift;
23 276 ▶ if ( $key eq 'DESTROY' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($key eq 'DESTROY') { } 0 276 276
elsif (not scalar @_) { } 261 15 276
24 0 delete $inside_out{ $callee };
25 } elsif ( ! scalar @_ ) {
26 261 $inside_out{ $callee }{ $key }
27 } else {
28 15 $inside_out{ $callee }{ $key } = shift;
29 }
30 }
31  
32 2 ▶sub destroy {
Subroutine destroy: called CC=1 SCAR=0.0
Pod undocumented
33 2 my $callee = shift;
34 2 delete $inside_out{ $callee };
35 }
36  
37 ########################################################################
38  
39 8 1;
40  
41 __END__
« MixinFactory.pm ↑ Summary MixinFactory/HasAFactory.pm »