line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=pod |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
ETL::Pipeline::Input::File::Table - Sequential input in rows and columns |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# In the input source... |
10
|
|
|
|
|
|
|
use Moose; |
11
|
|
|
|
|
|
|
with 'ETL::Pipeline::Input'; |
12
|
|
|
|
|
|
|
with 'ETL::Pipeline::Input::File'; |
13
|
|
|
|
|
|
|
with 'ETL::Pipeline::Input::File::Table'; |
14
|
|
|
|
|
|
|
... |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
CSV (comma separated values) or Excel spreadsheet files represent data in a |
19
|
|
|
|
|
|
|
table structure. Each row is a record. Each column an individual field. This |
20
|
|
|
|
|
|
|
role provides some attributes common for this type of data. That way you don't |
21
|
|
|
|
|
|
|
have to reinvent the wheel every time. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
package ETL::Pipeline::Input::File::Table; |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
3
|
|
2405
|
use 5.014000; |
|
3
|
|
|
|
|
11
|
|
28
|
|
|
|
|
|
|
|
29
|
3
|
|
|
3
|
|
15
|
use List::AllUtils qw/indexes/; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
193
|
|
30
|
3
|
|
|
3
|
|
17
|
use Moose::Role; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
29
|
|
31
|
3
|
|
|
3
|
|
14620
|
use String::Util qw/hascontent trim/; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
364
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our $VERSION = '2.00'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS & ATTRIBUTES |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 Arguments for L<ETL::Pipeline/input> |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head3 no_column_names |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Tabular data usually has field names in the very first row. This makes it |
44
|
|
|
|
|
|
|
easier for a human being to read. Sometimes, though, there are no field names. |
45
|
|
|
|
|
|
|
The data starts on the very first row. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Set B<no_column_name> to B<true> for these cases. Otherwise, the input source |
48
|
|
|
|
|
|
|
will load your first row of data as field names. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$etl->input( 'Excel', no_column_names => 1 ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has 'no_column_names' => ( |
55
|
|
|
|
|
|
|
default => 0, |
56
|
|
|
|
|
|
|
is => 'ro', |
57
|
|
|
|
|
|
|
isa => 'Bool', |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SEE ALSO |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
L<ETL::Pipeline>, L<ETL::Pipeline::Input>, L<ETL::Pipeline::Input::File> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Robert Wohlfarth <robert.j.wohlfarth@vumc.org> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 LICENSE |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Copyright 2021 (c) Vanderbilt University Medical Center |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
74
|
|
|
|
|
|
|
the same terms as Perl itself. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
3
|
|
|
3
|
|
22
|
no Moose; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
21
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Required by Perl to load the module. |
81
|
|
|
|
|
|
|
1; |