line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bootylicious::FileIteratorLoader; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
490
|
use strict; |
|
14
|
|
|
|
|
18
|
|
|
14
|
|
|
|
|
305
|
|
4
|
14
|
|
|
14
|
|
45
|
use warnings; |
|
14
|
|
|
|
|
20
|
|
|
14
|
|
|
|
|
278
|
|
5
|
|
|
|
|
|
|
|
6
|
14
|
|
|
14
|
|
45
|
use base 'Mojo::Base'; |
|
14
|
|
|
|
|
12
|
|
|
14
|
|
|
|
|
3488
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->attr('element_class'); |
9
|
|
|
|
|
|
|
__PACKAGE__->attr('filter'); |
10
|
|
|
|
|
|
|
__PACKAGE__->attr('root'); |
11
|
|
|
|
|
|
|
__PACKAGE__->attr('path'); |
12
|
|
|
|
|
|
|
|
13
|
14
|
|
|
14
|
|
59408
|
use Mojo::ByteStream; |
|
14
|
|
|
|
|
388743
|
|
|
14
|
|
|
|
|
576
|
|
14
|
14
|
|
|
14
|
|
4391
|
use Mojo::Loader qw(load_class); |
|
14
|
|
|
|
|
36870
|
|
|
14
|
|
|
|
|
672
|
|
15
|
14
|
|
|
14
|
|
2444
|
use Bootylicious::Iterator; |
|
14
|
|
|
|
|
21
|
|
|
14
|
|
|
|
|
84
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub files { |
18
|
58
|
|
|
58
|
0
|
63
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
58
|
|
|
|
|
174
|
my $root = $self->root; |
21
|
58
|
|
|
|
|
277
|
my $path = $self->path; |
22
|
|
|
|
|
|
|
|
23
|
58
|
100
|
|
|
|
4370
|
return glob $root ? "$root/*" : "$path*"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub create_element { |
27
|
93
|
|
|
93
|
0
|
123
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
93
|
|
|
|
|
223
|
load_class($self->element_class); |
30
|
|
|
|
|
|
|
|
31
|
93
|
|
|
|
|
1489
|
return $self->element_class->new; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub load { |
35
|
58
|
|
|
58
|
0
|
3661
|
my $self = shift; |
36
|
58
|
|
|
|
|
72
|
my $iterator = shift; |
37
|
|
|
|
|
|
|
|
38
|
58
|
|
66
|
|
|
307
|
$iterator ||= Bootylicious::Iterator->new; |
39
|
|
|
|
|
|
|
|
40
|
58
|
|
|
|
|
432
|
my $filter = $self->filter; |
41
|
|
|
|
|
|
|
|
42
|
58
|
|
|
|
|
102
|
my @elements = (); |
43
|
58
|
|
|
|
|
171
|
foreach my $file ($self->files) { |
44
|
113
|
|
|
|
|
428
|
$file = Mojo::ByteStream->new($file)->decode('UTF-8')->to_string; |
45
|
|
|
|
|
|
|
|
46
|
113
|
|
|
|
|
8634
|
my $basename = File::Basename::basename($file); |
47
|
113
|
100
|
66
|
|
|
1099
|
next if $filter && $basename !~ m/$filter/; |
48
|
|
|
|
|
|
|
|
49
|
93
|
|
|
|
|
244
|
my $element = $self->create_element; |
50
|
93
|
|
|
|
|
719
|
$element->load($file); |
51
|
|
|
|
|
|
|
|
52
|
93
|
|
|
|
|
169
|
push @elements, $element; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$iterator->elements( |
56
|
58
|
|
|
|
|
290
|
[sort { $b->created->epoch <=> $a->created->epoch } @elements]); |
|
55
|
|
|
|
|
226
|
|
57
|
58
|
|
|
|
|
447
|
$iterator->rewind; |
58
|
|
|
|
|
|
|
|
59
|
58
|
|
|
|
|
281
|
return $iterator; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |