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