line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spreadsheet::ExcelTableReader::Field; |
2
|
4
|
|
|
4
|
|
22
|
use Moo 2; |
|
4
|
|
|
|
|
110
|
|
|
4
|
|
|
|
|
33
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Field description for Spreadsheet::ExcelTableReader |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has name => ( is => 'ro', required => 1 ); |
8
|
|
|
|
|
|
|
has header => ( is => 'ro', required => 1 ); |
9
|
|
|
|
|
|
|
has required => ( is => 'ro', default => sub { 1 } ); |
10
|
|
|
|
|
|
|
has trim => ( is => 'ro', default => sub { 1 } ); |
11
|
|
|
|
|
|
|
has blank => ( is => 'ro' ); # default is undef |
12
|
|
|
|
|
|
|
has type => ( is => 'ro', isa => sub { $_[0]->can('check') }, required => 0 ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has header_regex => ( is => 'lazy' ); |
16
|
|
|
|
|
|
|
sub _build_header_regex { |
17
|
48
|
|
|
48
|
|
1597
|
my $self= shift; |
18
|
48
|
|
|
|
|
103
|
my $h= $self->header; |
19
|
48
|
50
|
|
|
|
472
|
return $h if ref($h) eq 'Regexp'; |
20
|
0
|
0
|
|
|
|
|
return $self->trim? qr/^\s*\Q$h\E\s*$/ : qr/^\Q$h\E$/; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |