line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Table2YAML::Loader::FixedWidth; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
980
|
use common::sense; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
4
|
1
|
|
|
1
|
|
62
|
use charnames q(:full); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
5
|
1
|
|
|
1
|
|
222
|
use English qw[-no_match_vars]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
569
|
use IO::File; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
249
|
|
7
|
1
|
|
|
1
|
|
7
|
use Moo::Role; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.003'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub load_fixedwidth { |
12
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
my @fixedwidth; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my @template = @{ $self->field_offset() }; |
|
0
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
foreach my $offset (@template) { |
18
|
0
|
|
|
|
|
|
substr $offset, 0, 0, q(A); |
19
|
|
|
|
|
|
|
} |
20
|
0
|
|
|
|
|
|
my $template = join q(), @template; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
local $INPUT_RECORD_SEPARATOR = $self->record_separator(); |
23
|
0
|
|
0
|
|
|
|
my $ref = ref $self->input() || q(); |
24
|
0
|
0
|
|
|
|
|
my $fw_fh |
25
|
|
|
|
|
|
|
= $ref eq q(GLOB) |
26
|
|
|
|
|
|
|
? $self->input() |
27
|
|
|
|
|
|
|
: IO::File->new( $self->input(), q(r) ); |
28
|
0
|
|
|
|
|
|
while ( my $record = readline $fw_fh ) { |
29
|
0
|
|
|
|
|
|
chomp $record; |
30
|
0
|
|
|
|
|
|
my @row = unpack $template, $record; |
31
|
0
|
|
|
|
|
|
push @fixedwidth, [@row]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return @fixedwidth; |
35
|
|
|
|
|
|
|
} ## end sub load_fixedwidth |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
1072
|
no Moo; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |