Librarian/Book.pm

filter: Statementstmt 50.0% 11 / 22 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 66.6% 4 / 6 Podpod 50.0% 1 / 2 totaltotal 34.0% 16 / 47 CC 7 SCAR 35.0
CC
7
Cov
31%
new
56.0
path
2.0
BEGIN
1.0
CRAP 33.2
↑ Summary Librarian.pm »
1 package JavaScript::Librarian::Book;
2  
3 # A fairly trivial subclass of Algorithm::Dependency::Item, which is also
4 # required to implement the ->path method, which returns the relative
5 # path of the actual .js file within the base path.
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use base 'Algorithm::Dependency::Item';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use vars qw{$VERSION};
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 $VERSION = '1.00';
13 }
14  
15  
16  
17  
18  
19 #####################################################################
20 # Constructor and Accessors
21  
22 # Implement a more complex constructor that will allow the use of ANY
23 # hash of values, as long as after creation, ->id, ->depends and ->path
24 # all return correctly.
25 0 ▶sub new {
Subroutine new: not called CC=7 SCAR=40.3
Pod documented
26 0 my $class = shift;
27 0 ▶ my %hash = ref $_[0] eq 'HASH' ? %{shift()} : return undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
28  
29 # Create the object
30 0 my $self = bless \%hash, $class;
31  
32 # Do our methods all behave correctly
33 0 ▶ $self->id or return undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->id or return undef 0 0 0
34 0 ▶ $self->path or return undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->path or return undef 0 0 0
35 0 ▶ if ( grep { ! defined $_ or ref $_ or $_ eq '' } $self->depends ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {not defined $_ or ref $_ or $_ eq "";} $self->depends) 0 0 0
Condition0%0/6
!defined($_) || ref $_ || $_ eq ''
l!l&&r!l&&!r
000
not defined $_ or ref $_
l!l&&r!l&&!r
000
MC/DC0%0/3
!defined($_) || ref $_ || $_ eq ''
not defined $_ ref $_ $_ eq ''
Truth table0%0/4
not(A) or B || C
A= not defined $_B= ref $_C= $_ eq ''
ABCresult
1XX1
01X1
0011
0000
36 0 return undef;
37 }
38  
39 0 $self;
40 }
41  
42 0 ▶sub path { $_[0]->{path} }
Subroutine path: not called CC=1 SCAR=6.9
Pod undocumented
43  
44 1 1;
↑ Summary Librarian.pm »