| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DataStore::CAS::FS::Dir; |
|
2
|
9
|
|
|
9
|
|
2597
|
use 5.008; |
|
|
9
|
|
|
|
|
33
|
|
|
|
9
|
|
|
|
|
404
|
|
|
3
|
9
|
|
|
9
|
|
68
|
use strict; |
|
|
9
|
|
|
|
|
24
|
|
|
|
9
|
|
|
|
|
285
|
|
|
4
|
9
|
|
|
9
|
|
48
|
use warnings; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
279
|
|
|
5
|
9
|
|
|
9
|
|
59
|
use Carp; |
|
|
9
|
|
|
|
|
52
|
|
|
|
9
|
|
|
|
|
657
|
|
|
6
|
9
|
|
|
9
|
|
976
|
use Try::Tiny; |
|
|
9
|
|
|
|
|
2125
|
|
|
|
9
|
|
|
|
|
6603
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION= '0.010000'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Object representing a directory of file entries, indexed by filename. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
1
|
618
|
sub file { $_[0]{file} } |
|
14
|
1
|
|
|
1
|
1
|
747
|
sub store { $_[0]{file}->store } |
|
15
|
97
|
|
|
97
|
1
|
1060
|
sub hash { $_[0]{file}->hash } |
|
16
|
1
|
|
|
1
|
1
|
7
|
sub size { $_[0]{file}->size } |
|
17
|
|
|
|
|
|
|
|
|
18
|
5
|
|
|
5
|
1
|
919
|
sub format { $_[0]{format} } |
|
19
|
|
|
|
|
|
|
|
|
20
|
7
|
|
|
7
|
1
|
2107
|
sub metadata { $_[0]{metadata} } |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
|
24
|
68
|
|
|
68
|
1
|
67687
|
my $class= shift; |
|
25
|
68
|
50
|
33
|
|
|
523
|
my %p= (1 == @_ && ref $_[0] eq 'HASH')? %{$_[0]} : @_; |
|
|
0
|
|
|
|
|
0
|
|
|
26
|
68
|
50
|
|
|
|
1333
|
defined $p{file} or croak "Attribute 'file' is required"; |
|
27
|
68
|
50
|
|
|
|
227
|
defined $p{format} or croak "Attribute 'format' is required"; |
|
28
|
68
|
|
100
|
|
|
231
|
$p{metadata} ||= {}; |
|
29
|
68
|
|
100
|
|
|
285
|
$p{_entries}= delete $p{entries} || []; |
|
30
|
68
|
|
|
|
|
689
|
bless \%p, $class; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub iterator { |
|
35
|
112
|
|
|
112
|
1
|
1209
|
my $list= $_[0]{_entries}; |
|
36
|
112
|
|
|
|
|
217
|
my ($i, $n)= (0, scalar @$list); |
|
37
|
112
|
100
|
|
372
|
|
801
|
return sub { $i < $n? $list->[$i++] : undef }; |
|
|
372
|
|
|
|
|
48685
|
|
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub get_entry { |
|
41
|
203
|
|
|
203
|
1
|
1701
|
my ($self, $name, $flags)= @_; |
|
42
|
|
|
|
|
|
|
return $flags->{case_insensitive}? |
|
43
|
|
|
|
|
|
|
($self->{_entry_name_map_caseless} ||= do { |
|
44
|
2
|
|
|
|
|
3
|
my (%lookup, $ent, $iter); |
|
45
|
2
|
|
|
|
|
6
|
for ($iter= $self->iterator; defined ($ent= $iter->()); ) { |
|
46
|
1
|
|
|
|
|
76
|
$lookup{uc $ent->name}= $ent |
|
47
|
|
|
|
|
|
|
} |
|
48
|
2
|
|
|
|
|
24
|
\%lookup; |
|
49
|
|
|
|
|
|
|
})->{uc $name} |
|
50
|
|
|
|
|
|
|
: |
|
51
|
203
|
100
|
33
|
|
|
1612
|
($self->{_entry_name_map} ||= do { |
|
|
|
|
66
|
|
|
|
|
|
52
|
48
|
|
|
|
|
73
|
my (%lookup, $ent, $iter); |
|
53
|
48
|
|
|
|
|
129
|
for ($iter= $self->iterator; defined ($ent= $iter->()); ) { |
|
54
|
116
|
|
|
|
|
3844
|
$lookup{$ent->name}= $ent |
|
55
|
|
|
|
|
|
|
} |
|
56
|
48
|
|
|
|
|
810267
|
\%lookup; |
|
57
|
|
|
|
|
|
|
})->{$name}; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |