line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
51114
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
124
|
|
2
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
177
|
|
3
|
|
|
|
|
|
|
package File::PlainPath; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Construct portable filesystem paths in a simple way |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.030'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
17
|
use File::Spec; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1157
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter; |
13
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(path to_path); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub import |
17
|
|
|
|
|
|
|
{ |
18
|
7
|
|
|
7
|
|
3722
|
my $class = shift; |
19
|
7
|
|
|
|
|
18
|
my %opts = (); |
20
|
7
|
|
|
|
|
11
|
my @export = (); |
21
|
7
|
|
|
|
|
40
|
while (@_) { |
22
|
11
|
|
|
|
|
19
|
my $arg = shift; |
23
|
11
|
100
|
|
|
|
47
|
if ($arg =~ m{^ [-] (.+) $}x) |
24
|
|
|
|
|
|
|
{ |
25
|
6
|
|
|
|
|
21
|
$opts{$1} = shift; |
26
|
6
|
|
|
|
|
23
|
next; |
27
|
|
|
|
|
|
|
} |
28
|
5
|
|
|
|
|
19
|
push @export, $arg; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
7
|
100
|
|
|
|
23
|
if (exists $opts{'separator'}) { |
32
|
6
|
|
|
|
|
119
|
$^H{+__PACKAGE__} = $opts{'separator'}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
7
|
|
|
|
|
23
|
@_ = ($class, @export); |
36
|
7
|
|
|
|
|
4070
|
goto \&Exporter::import; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub path { |
41
|
15
|
|
|
15
|
1
|
136
|
my @caller = caller(0); |
42
|
15
|
100
|
|
|
|
72
|
my $separator = exists $caller[10]{+__PACKAGE__} ? |
43
|
|
|
|
|
|
|
$caller[10]{+__PACKAGE__} : '/'; |
44
|
15
|
|
|
|
|
169
|
my $separator_re = qr{ \Q$separator\E }x; |
45
|
|
|
|
|
|
|
|
46
|
15
|
|
|
|
|
44
|
my @paths = @_; |
47
|
15
|
|
|
|
|
28
|
my @path_components = map { split($separator_re, $_) } @paths; |
|
19
|
|
|
|
|
138
|
|
48
|
|
|
|
|
|
|
|
49
|
15
|
|
|
|
|
351
|
return File::Spec->catfile(@path_components); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
*to_path = *path; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |