line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::DirObject::File; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
26
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
123
|
|
4
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1359
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub name { |
7
|
60
|
|
|
60
|
0
|
6424
|
my $self = shift; |
8
|
60
|
|
|
|
|
107
|
return ${$self}{'filename'}; |
|
60
|
|
|
|
|
573
|
|
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub dir { |
12
|
50
|
|
|
50
|
0
|
13264
|
my $self = shift; |
13
|
50
|
|
|
|
|
84
|
return ${$self}{'dir'}; |
|
50
|
|
|
|
|
201
|
|
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub extension { |
17
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
18
|
0
|
|
|
|
|
0
|
my @parts = split /\./, $self->name; |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
0
|
if (scalar @parts > 1) { |
21
|
0
|
|
|
|
|
0
|
return lc $parts[-1]; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
0
|
return ''; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub path { |
28
|
20
|
|
|
20
|
0
|
91
|
my $self = shift; |
29
|
20
|
|
|
|
|
74
|
my $dir = $self->dir; |
30
|
|
|
|
|
|
|
|
31
|
20
|
50
|
|
|
|
386
|
return $dir->is_cwd |
32
|
|
|
|
|
|
|
? $self->name |
33
|
|
|
|
|
|
|
: $dir->path . $self->name; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub full_path { |
37
|
20
|
|
|
20
|
0
|
51
|
my $self = shift; |
38
|
20
|
|
|
|
|
58
|
my $dir = $self->dir; |
39
|
20
|
|
|
|
|
52
|
return $self->name; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub new { |
43
|
20
|
|
|
20
|
0
|
55
|
my ($class, $dir, $filename) = @_; |
44
|
|
|
|
|
|
|
|
45
|
20
|
50
|
|
|
|
56
|
if (!(defined $dir)) { |
46
|
0
|
|
|
|
|
0
|
die "No parent directory found."; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
20
|
50
|
|
|
|
46
|
if (!(defined $filename)) { |
50
|
0
|
|
|
|
|
0
|
die "No filename supplied."; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
20
|
|
|
|
|
77
|
my $self = { |
54
|
|
|
|
|
|
|
'dir', $dir, 'filename', $filename |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
20
|
|
|
|
|
47
|
bless $self, $class; |
58
|
20
|
|
|
|
|
73
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |