line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Amazon::MechanicalTurk::RowData::DelimitedRowData; |
2
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
35
|
|
|
2
|
|
|
|
|
57
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
8
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
124
|
|
5
|
2
|
|
|
2
|
|
10
|
use Net::Amazon::MechanicalTurk::RowData; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
6
|
2
|
|
|
2
|
|
972
|
use Net::Amazon::MechanicalTurk::ModuleUtil; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
613
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw{ Net::Amazon::MechanicalTurk::RowData }; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::Amazon::MechanicalTurk::RowData::DelimitedRowData->attributes(qw{ |
13
|
|
|
|
|
|
|
reader |
14
|
|
|
|
|
|
|
}); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
2
|
|
|
2
|
0
|
3
|
my $self = shift; |
18
|
2
|
|
|
|
|
21
|
$self->setAttributes(@_); |
19
|
2
|
|
|
|
|
19
|
$self->assertRequiredAttributes(qw{ reader }); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub each { |
23
|
2
|
|
|
2
|
0
|
27
|
my ($self, $block, @blockXArgs) = @_; |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
3
|
my @fields; |
26
|
2
|
|
|
|
|
4
|
my $rowno = 0; |
27
|
2
|
|
|
|
|
6
|
while (my $row = $self->reader->next) { |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Skip empty rows |
30
|
21
|
100
|
66
|
|
|
20
|
next if ($#{$row} < 0 or ($#{$row} == 0) and $row->[0] eq ''); |
|
21
|
|
33
|
|
|
52
|
|
|
21
|
|
|
|
|
94
|
|
31
|
|
|
|
|
|
|
|
32
|
12
|
100
|
|
|
|
26
|
if ($rowno++ == 0) { |
33
|
2
|
|
|
|
|
5
|
@fields = @${row}; |
34
|
2
|
|
|
|
|
20
|
$self->fieldNames(\@fields); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { |
37
|
10
|
|
|
|
|
9
|
my %hash; |
38
|
10
|
|
|
|
|
20
|
for (my $i=0; $i<=$#fields; $i++) { |
39
|
20
|
50
|
|
|
|
16
|
if ($i <= $#{$row}) { |
|
20
|
|
|
|
|
63
|
|
40
|
20
|
|
|
|
|
71
|
$hash{$fields[$i]} = $row->[$i]; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
else { |
43
|
0
|
|
|
|
|
0
|
$hash{$fields[$i]} = ''; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
10
|
|
|
|
|
35
|
$block->($self, \%hash, @blockXArgs); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return 1; |