line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Evo::Path; |
2
|
9
|
|
|
9
|
|
5306
|
use Evo -Class, 'Carp croak'; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
79
|
|
3
|
|
|
|
|
|
|
use overload |
4
|
888
|
|
|
888
|
|
4298
|
'""' => sub { shift->to_string }, |
5
|
9
|
|
|
9
|
|
1667
|
fallback => 1; |
|
9
|
|
|
|
|
1304
|
|
|
9
|
|
|
|
|
196
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has base => '/'; |
8
|
|
|
|
|
|
|
has children => sub { [] }; |
9
|
|
|
|
|
|
|
|
10
|
662
|
50
|
|
662
|
|
1442
|
my sub _split ($safe, $path) { |
|
662
|
50
|
|
|
|
1377
|
|
|
662
|
|
|
|
|
923
|
|
|
662
|
|
|
|
|
987
|
|
|
662
|
|
|
|
|
890
|
|
11
|
662
|
100
|
|
|
|
1373
|
return if !$path; |
12
|
659
|
100
|
|
|
|
1465
|
return grep { !!$_ } split '/', $path if !$safe; |
|
6
|
|
|
|
|
55
|
|
13
|
|
|
|
|
|
|
grep { |
14
|
1015
|
100
|
|
|
|
6967
|
$_ ne '..' |
15
|
|
|
|
|
|
|
? 1 |
16
|
|
|
|
|
|
|
: croak qq#unsafe "$path", use "append_unsafe" instead (or \$fs->cd('..'))# |
17
|
656
|
100
|
|
|
|
1870
|
} grep { !!$_ && $_ ne '.' } split '/', $path; |
|
1467
|
|
|
|
|
5820
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
83
|
50
|
|
83
|
1
|
989
|
sub append ($self, $path) { |
|
83
|
50
|
|
|
|
195
|
|
|
83
|
|
|
|
|
128
|
|
|
83
|
|
|
|
|
144
|
|
|
83
|
|
|
|
|
119
|
|
21
|
83
|
|
|
|
|
392
|
(ref $self)->new(base => $self->base, children => [$self->children->@*, _split(1, $path)]); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
3
|
50
|
|
3
|
1
|
20
|
sub append_unsafe ($self, $path) { |
|
3
|
50
|
|
|
|
17
|
|
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
8
|
|
25
|
3
|
|
|
|
|
31
|
(ref $self)->new(base => $self->base, children => [$self->children->@*, _split(0, $path)]); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
1465
|
50
|
|
1465
|
0
|
5111
|
sub to_string($self) { |
|
1465
|
50
|
|
|
|
2806
|
|
|
1465
|
|
|
|
|
2026
|
|
|
1465
|
|
|
|
|
1878
|
|
29
|
1465
|
|
|
|
|
2864
|
my $base = $self->base; |
30
|
1465
|
100
|
|
|
|
3844
|
$base .= '/' unless $base =~ m#/$#; |
31
|
1465
|
|
|
|
|
18659
|
$base . join '/', $self->children->@*; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
576
|
50
|
|
576
|
0
|
11577
|
sub from_string ($me, $path = undef, $base = '/') { |
|
576
|
50
|
|
|
|
1262
|
|
|
576
|
100
|
|
|
|
974
|
|
|
576
|
|
|
|
|
868
|
|
|
576
|
|
|
|
|
1198
|
|
|
576
|
|
|
|
|
801
|
|
35
|
576
|
|
|
|
|
1211
|
$me->new(base => $base, children => [_split(1, $path)]); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |