line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Evo::Path; |
2
|
9
|
|
|
9
|
|
4360
|
use Evo -Class, 'Carp croak'; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
65
|
|
3
|
|
|
|
|
|
|
use overload |
4
|
888
|
|
|
888
|
|
4075
|
'""' => sub { shift->to_string }, |
5
|
9
|
|
|
9
|
|
917
|
fallback => 1; |
|
9
|
|
|
|
|
763
|
|
|
9
|
|
|
|
|
73
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has base => '/'; |
8
|
|
|
|
|
|
|
has children => sub { [] }; |
9
|
|
|
|
|
|
|
|
10
|
662
|
50
|
|
662
|
|
1305
|
my sub _split ($safe, $path) { |
|
662
|
50
|
|
|
|
1243
|
|
|
662
|
|
|
|
|
952
|
|
|
662
|
|
|
|
|
869
|
|
|
662
|
|
|
|
|
796
|
|
11
|
662
|
100
|
|
|
|
1331
|
return if !$path; |
12
|
659
|
100
|
|
|
|
1412
|
return grep { !!$_ } split '/', $path if !$safe; |
|
6
|
|
|
|
|
369
|
|
13
|
|
|
|
|
|
|
grep { |
14
|
1015
|
100
|
|
|
|
6120
|
$_ ne '..' |
15
|
|
|
|
|
|
|
? 1 |
16
|
|
|
|
|
|
|
: croak qq#unsafe "$path", use "append_unsafe" instead (or \$fs->cd('..'))# |
17
|
656
|
100
|
|
|
|
1557
|
} grep { !!$_ && $_ ne '.' } split '/', $path; |
|
1467
|
|
|
|
|
5341
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
83
|
50
|
|
83
|
1
|
488
|
sub append ($self, $path) { |
|
83
|
50
|
|
|
|
171
|
|
|
83
|
|
|
|
|
122
|
|
|
83
|
|
|
|
|
109
|
|
|
83
|
|
|
|
|
119
|
|
21
|
83
|
|
|
|
|
293
|
(ref $self)->new(base => $self->base, children => [$self->children->@*, _split(1, $path)]); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
3
|
50
|
|
3
|
1
|
14
|
sub append_unsafe ($self, $path) { |
|
3
|
50
|
|
|
|
19
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
7
|
|
25
|
3
|
|
|
|
|
20
|
(ref $self)->new(base => $self->base, children => [$self->children->@*, _split(0, $path)]); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
1465
|
50
|
|
1465
|
0
|
3651
|
sub to_string($self) { |
|
1465
|
50
|
|
|
|
2591
|
|
|
1465
|
|
|
|
|
1887
|
|
|
1465
|
|
|
|
|
1755
|
|
29
|
1465
|
|
|
|
|
2714
|
my $base = $self->base; |
30
|
1465
|
100
|
|
|
|
3651
|
$base .= '/' unless $base =~ m#/$#; |
31
|
1465
|
|
|
|
|
16233
|
$base . join '/', $self->children->@*; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
576
|
50
|
|
576
|
0
|
7699
|
sub from_string ($me, $path = undef, $base = '/') { |
|
576
|
50
|
|
|
|
1125
|
|
|
576
|
100
|
|
|
|
856
|
|
|
576
|
|
|
|
|
761
|
|
|
576
|
|
|
|
|
1104
|
|
|
576
|
|
|
|
|
708
|
|
35
|
576
|
|
|
|
|
1138
|
$me->new(base => $base, children => [_split(1, $path)]); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |