blib/lib/Object/Composer.pm

filter: Statementstmt 100% 35 / 35 Branchbran 66.6% 4 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 92.7% 51 / 55 CC 5 SCAR 9.9
CC
5
Cov
93%
load
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
↑ Summary
1 package Object::Composer;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 3 our $VERSION = q(0.0.2);
9  
10  
11 3 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
12 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 shift;
15  
16 3 my $caller_package = caller( );
17 3 *{"$caller_package\::load"} = \&{ __PACKAGE__ . '::load' };
18 }
19  
20  
21 4 ▶sub load {
Subroutine load: called CC=5 SCAR=16.2
Pod documented
22 4 my ( @all ) = @_;
23  
24 4 ▶ croak 'No arguments given, not sure what you want me to do?'
Branch: 1 branch
BranchTrueFalseTotal
unless @all 0 4 4
25 unless @all;
26  
27 # Getting called as a Class Method / Object Instance method
28 # ignore the first argument
29 4 ▶ shift if $all[0] eq __PACKAGE__ || $all[0]->isa( __PACKAGE__ );
Branch: 1 branch
BranchTrueFalseTotal
if $all[0] eq __PACKAGE__ or $all[0]->isa(__PACKAGE__) 1 3 4
Condition66%2/3
$all[0] eq __PACKAGE__ or $all[0]->isa(__PACKAGE__)
l!l&&r!l&&!r
103
MC/DC50%1/2
$all[0] eq __PACKAGE__ or $all[0]->isa(__PACKAGE__)
$all[0] eq __PACKAGE__ $all[0]->isa(__PACKAGE__)
Truth table66%2/3
A or B
A= $all[0] eq __PACKAGE__B= $all[0]->isa(__PACKAGE__)
ABresult
1X1
011
000
30  
31 4 my $obj;
32 4 my ( $package, @args ) = @_;
33
34 4 my $code = <<USE;
35 use $package;
36 USE
37  
38 4 ▶ eval $code;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
39 4 $obj = $package->new( @args );
40  
41 4 ▶ croak "There was an error loading: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 4 4
42
43 4 $obj;
44 }
45  
46  
47 3 'done';
48  
49  
50 __END__
↑ Summary