line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Table2YAML::Loader; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use common::sense; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
4
|
1
|
|
|
1
|
|
65
|
use charnames q(:full); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
5
|
1
|
|
|
1
|
|
1179
|
use Carp; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
136
|
|
6
|
1
|
|
|
1
|
|
7
|
use English qw[-no_match_vars]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
7
|
1
|
|
|
1
|
|
843
|
use List::Util qw[first]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
141
|
|
8
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
9
|
|
|
|
|
|
|
with qw[ |
10
|
|
|
|
|
|
|
App::Table2YAML::Loader::AsciiTable |
11
|
|
|
|
|
|
|
App::Table2YAML::Loader::DSV |
12
|
|
|
|
|
|
|
App::Table2YAML::Loader::FixedWidth |
13
|
|
|
|
|
|
|
App::Table2YAML::Loader::HTML |
14
|
|
|
|
|
|
|
App::Table2YAML::Loader::LaTeX |
15
|
|
|
|
|
|
|
App::Table2YAML::Loader::Texinfo |
16
|
|
|
|
|
|
|
]; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.003'; # VERSION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has input => ( |
21
|
|
|
|
|
|
|
is => q(rw), |
22
|
|
|
|
|
|
|
isa => sub { -e $_[0] && -r $_[0] && -f $_[0] && -s $_[0] }, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
has input_type => ( is => q(rw), default => q(), ); |
25
|
|
|
|
|
|
|
has field_separator => ( |
26
|
|
|
|
|
|
|
is => q(rw), |
27
|
|
|
|
|
|
|
isa => sub { @_ == 1 && length $_[0] == 1 }, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
has record_separator => ( |
30
|
|
|
|
|
|
|
is => q(rw), |
31
|
|
|
|
|
|
|
isa => sub { |
32
|
|
|
|
|
|
|
@_ == 1 && first { $_[0] eq $_ } ( |
33
|
|
|
|
|
|
|
qq(\N{CARRIAGE RETURN}), |
34
|
|
|
|
|
|
|
qq(\N{LINE FEED}), |
35
|
|
|
|
|
|
|
qq(\N{CARRIAGE RETURN}\N{LINE FEED}), |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
default => qq{\N{LINE FEED}}, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
has field_offset => ( |
41
|
|
|
|
|
|
|
is => q(rw), |
42
|
|
|
|
|
|
|
isa => sub { ref $_[0] eq q(ARRAY); }, |
43
|
|
|
|
|
|
|
default => sub { []; }, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub BUILD { |
47
|
2
|
|
|
2
|
0
|
33
|
my $self = shift; |
48
|
2
|
|
|
|
|
5
|
my $args = shift; |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
4
|
foreach my $arg ( keys %{$args} ) { |
|
2
|
|
|
|
|
10
|
|
51
|
0
|
0
|
|
|
|
0
|
if ( $self->can($arg) ) { |
52
|
0
|
|
|
|
|
0
|
$self->$arg( delete $args->{$arg} ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
|
|
49
|
return 1; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub load { |
60
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
1
|
50
|
33
|
|
|
15
|
if ( !( defined $self->input_type() ) || $self->input_type() eq q() ) { |
63
|
0
|
|
0
|
|
|
0
|
croak( |
64
|
|
|
|
|
|
|
sprintf q(invalid input_type: '%s'), |
65
|
|
|
|
|
|
|
$self->input_type() // q(undef), |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
6
|
my $loader = q(load_) . lc $self->input_type(); |
70
|
1
|
|
|
|
|
8
|
my @table = $self->$loader(); |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
28
|
return @table; |
73
|
|
|
|
|
|
|
} ## end sub load |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
|
46040
|
no Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
13
|
|
76
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |