| 1 | package IO::All::Dir; | ||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use IO::All::Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 3 | extends 'IO::All::Filesys'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | # Upgrade from IO::All to IO::All::Dir | ||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use constant upgrade_methods => [qw(dir mkdir)]; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | sub can_upgrade { | ||||||||||||||||||||||||||
|
Subroutine
can_upgrade: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | 2 | my ($self, $object) = @_; | |||||||||||||||||||||||||||
| 10 | 2 | my $location = $object->location; | |||||||||||||||||||||||||||
| 11 | return if | ||||||||||||||||||||||||||||
| 12 | 2 | ▶ | not defined $location or | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $location and length $location
MC/DC50%1/2
defined $location and length $location
defined $location
length $location
Truth table66%2/3
A and B
A= defined $locationB= length $location
| |||||||||||||||||||||||||||||
| 13 | not length $location; | ||||||||||||||||||||||||||||
| 14 | 1 | -d $location; | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub dir { | ||||||||||||||||||||||||||
|
Subroutine
dir: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 19 | 0 | ▶ | $self->name(shift) if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | return $self; | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub mkdir { | ||||||||||||||||||||||||||
|
Subroutine
mkdir: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 25 | 0 | my $name = $self->name; | |||||||||||||||||||||||||||
| 26 | 0 | my $strict = $self->{_strict}; | |||||||||||||||||||||||||||
| 27 | 0 | ▶ | if (-d $name) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | return unless $strict; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | $self->throw("Can't mkdir $name. Directory already exists."); | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | CORE::mkdir($name) or $self->throw("mkdir $name failed: $!"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 3 | 1; | |||||||||||||||||||||||||||