| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | $self->path or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if ( grep { ! defined $_ or ref $_ or $_ eq '' } $self->depends ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
!defined($_) || ref $_ || $_ eq ''
not defined $_ or ref $_
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 ''
| |||||||||||||||||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||||||||||||||||