line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::All::Dir; |
2
|
3
|
|
|
3
|
|
3954
|
use IO::All::Base; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
44
|
|
3
|
|
|
|
|
|
|
extends 'IO::All::Filesys'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Upgrade from IO::All to IO::All::Dir |
6
|
3
|
|
|
3
|
|
17
|
use constant upgrade_methods => [qw(dir mkdir)]; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1066
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub can_upgrade { |
9
|
2
|
|
|
2
|
0
|
4
|
my ($self, $object) = @_; |
10
|
2
|
|
|
|
|
10
|
my $location = $object->location; |
11
|
|
|
|
|
|
|
return if |
12
|
2
|
100
|
66
|
|
|
21
|
not defined $location or |
13
|
|
|
|
|
|
|
not length $location; |
14
|
1
|
|
|
|
|
22
|
-d $location; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub dir { |
18
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
19
|
0
|
0
|
|
|
|
|
$self->name(shift) if @_; |
20
|
0
|
|
|
|
|
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub mkdir { |
24
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
25
|
0
|
|
|
|
|
|
my $name = $self->name; |
26
|
0
|
|
|
|
|
|
my $strict = $self->{_strict}; |
27
|
0
|
0
|
|
|
|
|
if (-d $name) { |
28
|
0
|
0
|
|
|
|
|
return unless $strict; |
29
|
0
|
|
|
|
|
|
$self->throw("Can't mkdir $name. Directory already exists."); |
30
|
|
|
|
|
|
|
} |
31
|
0
|
0
|
|
|
|
|
CORE::mkdir($name) or $self->throw("mkdir $name failed: $!"); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |