line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Path::Extended::Class::Dir; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2050
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
124
|
|
4
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
110
|
|
5
|
3
|
|
|
3
|
|
19
|
use base qw( Path::Extended::Dir ); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
2047
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub _initialize { |
8
|
102
|
|
|
102
|
|
271
|
my ($self, @args) = @_; |
9
|
|
|
|
|
|
|
|
10
|
102
|
100
|
100
|
|
|
530
|
return if @args && !defined $args[0]; |
11
|
|
|
|
|
|
|
|
12
|
101
|
100
|
|
|
|
785
|
my $dir = @args ? File::Spec->catdir( @args ) : File::Spec->curdir; |
13
|
|
|
|
|
|
|
|
14
|
101
|
|
|
|
|
416
|
$self->_set_path($dir); |
15
|
101
|
|
|
|
|
248
|
$self->{is_dir} = 1; |
16
|
101
|
|
|
|
|
187
|
$self->{_compat} = 1; |
17
|
|
|
|
|
|
|
|
18
|
101
|
|
|
|
|
494
|
$self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new_foreign { |
22
|
0
|
|
|
0
|
1
|
0
|
my ($class, $type, @args) = @_; |
23
|
0
|
|
|
|
|
0
|
$class->new(@args); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub absolute { |
27
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
28
|
2
|
|
|
|
|
7
|
$self->{_base} = undef; |
29
|
2
|
|
|
|
|
17
|
$self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub relative { |
33
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
34
|
0
|
0
|
|
|
|
0
|
my $base = @_ % 2 ? shift : undef; |
35
|
0
|
|
|
|
|
0
|
my %options = @_; |
36
|
0
|
|
0
|
|
|
0
|
$self->{_base} = $base || $options{base} || File::Spec->curdir; |
37
|
0
|
|
|
|
|
0
|
$self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
0
|
sub cleanup { shift } # is always clean |
41
|
15
|
|
|
15
|
1
|
98
|
sub as_foreign { shift } # does nothing |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub dir_list { |
44
|
11
|
|
|
11
|
1
|
3482
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
11
|
|
|
|
|
40
|
my @parts = $self->_parts; |
47
|
11
|
100
|
|
|
|
38
|
return @parts unless @_; |
48
|
|
|
|
|
|
|
|
49
|
9
|
|
|
|
|
10
|
my $offset = shift; |
50
|
9
|
100
|
|
|
|
27
|
$offset = @parts + $offset if $offset < 0; |
51
|
|
|
|
|
|
|
|
52
|
9
|
100
|
|
|
|
42
|
return wantarray ? @parts[$offset .. $#parts] : $parts[$offset] unless @_; |
|
|
100
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
5
|
|
|
|
|
6
|
my $length = shift; |
55
|
5
|
100
|
|
|
|
11
|
$length = @parts + $length - $offset if $length < 0; |
56
|
5
|
|
|
|
|
23
|
return @parts[$offset .. $length + $offset - 1]; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub tempfile { |
60
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
61
|
0
|
|
|
|
|
0
|
require File::Temp; |
62
|
0
|
|
|
|
|
0
|
return File::Temp::tempfile(@_, DIR => $self->stringify); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
8
|
|
|
8
|
1
|
97
|
sub mkdir {require File::Path; File::Path::mkpath(shift->path, @_)} |
|
8
|
|
|
|
|
32
|
|
66
|
7
|
|
|
7
|
1
|
3923
|
sub rmdir {require File::Path; File::Path::rmtree(shift->path, @_)} |
|
7
|
|
|
|
|
31
|
|
67
|
|
|
|
|
|
|
*mkpath = \&mkdir; |
68
|
|
|
|
|
|
|
*rmtree = *remove = \&rmdir; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |