| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
|
2
|
|
|
|
|
|
|
package Data::Resolver::FromDir; |
|
3
|
3
|
|
|
3
|
|
749429
|
use v5.24; |
|
|
3
|
|
|
|
|
12
|
|
|
4
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
281
|
|
|
5
|
3
|
|
|
3
|
|
21
|
use experimental 'signatures'; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
43
|
|
|
6
|
3
|
|
|
3
|
|
1834
|
use English '-no_match_vars'; |
|
|
3
|
|
|
|
|
2177
|
|
|
|
3
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
2529
|
use File::Spec::Functions qw< catdir catpath splitdir splitpath >; |
|
|
3
|
|
|
|
|
1899
|
|
|
|
3
|
|
|
|
|
274
|
|
|
9
|
3
|
|
|
3
|
|
20
|
use File::Spec::Unix (); |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
96
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
1279
|
use Moo; |
|
|
3
|
|
|
|
|
18220
|
|
|
|
3
|
|
|
|
|
19
|
|
|
12
|
3
|
|
|
3
|
|
5259
|
no warnings 'experimental::signatures'; |
|
|
3
|
|
|
|
|
34
|
|
|
|
3
|
|
|
|
|
130
|
|
|
13
|
3
|
|
|
3
|
|
1136
|
use namespace::clean; |
|
|
3
|
|
|
|
|
38190
|
|
|
|
3
|
|
|
|
|
30
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
extends 'Data::Resolver::Base'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has root => (is => 'ro', required => 1); |
|
18
|
|
|
|
|
|
|
has _volume => (is => 'lazy', init_arg => undef); |
|
19
|
|
|
|
|
|
|
has _dirs => (is => 'rwp', init_arg => undef); |
|
20
|
|
|
|
|
|
|
|
|
21
|
6
|
|
|
6
|
|
58
|
sub _build__volume ($self) { |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
13
|
|
|
22
|
6
|
|
|
|
|
32
|
my ($volume, $dirs) = splitpath($self->root, 'no_file'); |
|
23
|
6
|
|
|
|
|
71
|
$self->_set__dirs([splitdir($dirs)]); |
|
24
|
6
|
|
|
|
|
102
|
return $volume; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
21
|
|
|
21
|
|
37
|
sub _child ($self, $key) { |
|
|
21
|
|
|
|
|
64
|
|
|
|
21
|
|
|
|
|
36
|
|
|
|
21
|
|
|
|
|
37
|
|
|
28
|
21
|
|
|
|
|
321
|
my (undef, $dirs, $target) = File::Spec::Unix->splitpath($key); |
|
29
|
21
|
|
|
|
|
631
|
my $v = $self->_volume; # makes sure that _dirs is initialized too |
|
30
|
21
|
|
|
|
|
320
|
$dirs = catdir($self->_dirs->@*, File::Spec::Unix->splitdir($dirs)); |
|
31
|
21
|
|
|
|
|
78
|
return catpath($v, $dirs, $target) |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
5
|
|
|
5
|
|
11
|
sub _children ($self, $test) { |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
10
|
|
|
35
|
5
|
|
|
|
|
17
|
my $root = $self->root; |
|
36
|
5
|
50
|
|
|
|
387
|
opendir my $dh, $root |
|
37
|
|
|
|
|
|
|
or $self->complain(400, "opendir('$root'): $OS_ERROR"); |
|
38
|
5
|
50
|
|
|
|
188
|
my @rv = readdir($dh) |
|
39
|
|
|
|
|
|
|
or $self->complain(400, "readdir('$root'): $OS_ERROR"); |
|
40
|
5
|
50
|
|
|
|
89
|
closedir $dh |
|
41
|
|
|
|
|
|
|
or $self->complain(400, "closedir('$root'): $OS_ERROR"); |
|
42
|
5
|
|
|
|
|
19
|
return grep { $test->($_) } @rv; |
|
|
24
|
|
|
|
|
397
|
|
|
43
|
|
|
|
|
|
|
} ## end sub _children |
|
44
|
|
|
|
|
|
|
|
|
45
|
7
|
|
|
7
|
1
|
2909
|
sub get_asset ($self, $key) { |
|
|
7
|
|
|
|
|
16
|
|
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
14
|
|
|
46
|
7
|
|
|
|
|
21
|
my $child = $self->_child($key); |
|
47
|
7
|
50
|
|
|
|
226
|
$self->not_found($key) unless -f $child; |
|
48
|
7
|
|
|
|
|
77
|
my (undef, undef, $basename) = File::Spec::Unix->splitpath($key); |
|
49
|
7
|
|
|
|
|
57
|
return $self->asset($basename => file => $child); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
5
|
|
|
5
|
1
|
1016
|
sub get_sub_resolver ($self, $key) { |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
8
|
|
|
53
|
5
|
|
|
|
|
18
|
my $child = $self->_child($key); |
|
54
|
5
|
50
|
|
|
|
174
|
$self->not_found($key) unless -d $child; |
|
55
|
5
|
|
|
|
|
141
|
return $self->new(root => $child); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
4
|
|
50
|
4
|
1
|
2097
|
sub has_asset ($self, $key) { -f ($self->_child($key) // '') } |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
16
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
5
|
|
50
|
5
|
1
|
1879
|
sub has_sub_resolver ($self, $key) { -d ($self->_child($key) // '') } |
|
|
5
|
|
|
|
|
13
|
|
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
18
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
3
|
|
|
3
|
1
|
3879
|
sub list_asset_keys ($self) { |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
6
|
|
|
63
|
3
|
|
|
|
|
114
|
my $v = $self->_volume; |
|
64
|
3
|
|
|
|
|
26
|
my $dirs = catdir($self->_dirs->@*); |
|
65
|
3
|
|
|
14
|
|
23
|
$self->_children(sub ($item) { -f catpath($v, $dirs, $item) }); |
|
|
14
|
|
|
|
|
41
|
|
|
|
14
|
|
|
|
|
26
|
|
|
|
14
|
|
|
|
|
25
|
|
|
|
14
|
|
|
|
|
23
|
|
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
2
|
|
|
2
|
1
|
2365
|
sub list_sub_resolver_keys ($self) { |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
4
|
|
|
69
|
2
|
|
|
|
|
55
|
my $v = $self->_volume; |
|
70
|
2
|
|
|
|
|
33
|
my $dirs = catdir($self->_dirs->@*); |
|
71
|
2
|
|
|
10
|
|
14
|
$self->_children(sub ($item) { -d catpath($v, $dirs, $item) }); |
|
|
10
|
|
|
|
|
35
|
|
|
|
10
|
|
|
|
|
16
|
|
|
|
10
|
|
|
|
|
21
|
|
|
|
10
|
|
|
|
|
15
|
|
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |