line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Basename::Object; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1077
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
53
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
5
|
1
|
|
|
1
|
|
29
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
89
|
|
6
|
|
|
|
|
|
|
use overload |
7
|
1
|
|
|
|
|
13
|
'""' => \&_as_string, |
8
|
|
|
|
|
|
|
'cmp' => \&_compare, |
9
|
|
|
|
|
|
|
'<=>' => \&_compare_basename, |
10
|
|
|
|
|
|
|
fallback => 1, |
11
|
1
|
|
|
1
|
|
6
|
; |
|
1
|
|
|
|
|
1
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
106
|
use File::Basename (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
246
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
return 1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
5
|
|
|
5
|
1
|
512
|
my $class = shift; |
21
|
5
|
|
|
|
|
29
|
return bless [ @_ ], $class; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub fullname { |
25
|
15
|
|
|
15
|
1
|
24
|
my($self, $path) = @_; |
26
|
15
|
|
|
|
|
21
|
my $old_path = $self->[0]; |
27
|
15
|
100
|
|
|
|
39
|
$self->[0] = $path if(@_ > 1); |
28
|
15
|
|
|
|
|
43
|
return $old_path; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub suffixlist { |
32
|
14
|
|
|
14
|
1
|
26
|
my($self, @suffixes) = @_; |
33
|
1
|
|
|
1
|
|
1108
|
my @old_suffixes = @{$self}[$[ + 1 .. $#$self]; |
|
1
|
|
|
|
|
477
|
|
|
1
|
|
|
|
|
469
|
|
|
14
|
|
|
|
|
45
|
|
|
14
|
|
|
|
|
30
|
|
34
|
14
|
100
|
|
|
|
38
|
splice(@$self, $[ + 1, $#$self, @suffixes) if(@_ > 1); |
35
|
14
|
|
|
|
|
414
|
return @old_suffixes; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub no_suffixes { |
39
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
40
|
1
|
|
|
|
|
9
|
return splice(@$self, 1); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub copy { |
44
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
45
|
2
|
|
|
|
|
10
|
my $rv = ref($self)->new(@$self); |
46
|
2
|
100
|
|
|
|
7
|
if(my $path = shift) { |
47
|
1
|
|
|
|
|
10
|
$rv->fullname($path); |
48
|
|
|
|
|
|
|
} |
49
|
2
|
|
|
|
|
6
|
return $rv; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _as_string { |
53
|
8
|
|
|
8
|
|
48
|
my $self = shift; |
54
|
8
|
|
|
|
|
45
|
return $self->[0]; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub fileparse { |
58
|
11
|
|
|
11
|
1
|
18
|
my $self = shift; |
59
|
11
|
|
|
|
|
18
|
return File::Basename::fileparse($self->fullname, $self->suffixlist); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub basename { |
63
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
64
|
1
|
|
|
|
|
3
|
return File::Basename::basename($self->fullname, $self->suffixlist); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub dirname { |
68
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
69
|
1
|
|
|
|
|
4
|
return File::Basename::dirname($self->fullname, $self->suffixlist); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _compare { |
73
|
4
|
|
|
4
|
|
23
|
my($a, $b) = @_; |
74
|
4
|
|
|
|
|
9
|
return "$a" cmp "$b"; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _compare_basename { |
78
|
7
|
|
|
7
|
|
12
|
my($a, $b) = @_; |
79
|
7
|
100
|
|
|
|
29
|
if(UNIVERSAL::isa($b, __PACKAGE__)) { |
80
|
5
|
|
|
|
|
11
|
return scalar($a->fileparse) cmp scalar($b->fileparse); |
81
|
|
|
|
|
|
|
} else { |
82
|
2
|
|
|
|
|
9
|
return $a->_compare_basename(__PACKAGE__->new($b, @{$a}[ $[ + 1 .. $#$a ])); |
|
2
|
|
|
|
|
8
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |