line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Data::Split; |
2
|
|
|
|
|
|
|
$Test::Data::Split::VERSION = '0.2.1'; |
3
|
3
|
|
|
3
|
|
166952
|
use strict; |
|
3
|
|
|
|
|
24
|
|
|
3
|
|
|
|
|
69
|
|
4
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
56
|
|
5
|
3
|
|
|
3
|
|
1163
|
use autodie; |
|
3
|
|
|
|
|
38034
|
|
|
3
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
16562
|
use 5.008; |
|
3
|
|
|
|
|
14
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
1318
|
use IO::All qw/ io /; |
|
3
|
|
|
|
|
33310
|
|
|
3
|
|
|
|
|
17
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
1584
|
use MooX qw/ late /; |
|
3
|
|
|
|
|
24884
|
|
|
3
|
|
|
|
|
17
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '_target_dir' => (is => 'ro', isa => 'Str', required => 1, init_arg => 'target_dir',); |
15
|
|
|
|
|
|
|
has ['_filename_cb'] => (is => 'ro', isa => 'CodeRef', required => 1, init_arg => 'filename_cb',); |
16
|
|
|
|
|
|
|
has ['_contents_cb'] => (is => 'ro', isa => 'CodeRef', required => 1, init_arg => 'contents_cb',); |
17
|
|
|
|
|
|
|
has '_data_obj' => (is => 'ro', required => 1, init_arg => 'data_obj'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub run |
21
|
|
|
|
|
|
|
{ |
22
|
4
|
|
|
4
|
1
|
11307
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
|
|
17
|
my $target_dir = $self->_target_dir; |
25
|
4
|
|
|
|
|
13
|
my $filename_cb = $self->_filename_cb; |
26
|
4
|
|
|
|
|
12
|
my $contents_cb = $self->_contents_cb; |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
10
|
my $data_obj = $self->_data_obj; |
29
|
|
|
|
|
|
|
|
30
|
4
|
|
|
|
|
11
|
foreach my $id (@{ $data_obj->list_ids() }) |
|
4
|
|
|
|
|
11
|
|
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
# Croak on bad IDs. |
33
|
17
|
50
|
|
|
|
15002
|
if ($id !~ /\A[A-Za-z_\-0-9]{1,80}\z/) |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
|
|
0
|
die "Invalid id '$id'."; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
17
|
|
|
|
|
47
|
io->catfile($target_dir, $filename_cb->($self, { id => $id, }, )) |
39
|
|
|
|
|
|
|
->assert->print( |
40
|
|
|
|
|
|
|
$contents_cb->($self, { id => $id, data => $data_obj->lookup_data($id) },) |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
1880
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |