line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TableData::Object; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2021-01-10'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'TableData-Object'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.113'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
2087
|
use 5.010001; |
|
4
|
|
|
|
|
29
|
|
9
|
4
|
|
|
4
|
|
17
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
83
|
|
10
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
117
|
|
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
1902
|
use Data::Check::Structure qw(is_aos is_aoaos is_aohos); |
|
4
|
|
|
|
|
5436
|
|
|
4
|
|
|
|
|
988
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require Exporter; |
15
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
16
|
|
|
|
|
|
|
our @EXPORT_OK = qw(table); |
17
|
|
|
|
|
|
|
|
18
|
49
|
|
|
49
|
1
|
23671
|
sub table { __PACKAGE__->new(@_) } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
49
|
|
|
49
|
1
|
110
|
my ($class, $data, $spec) = @_; |
22
|
49
|
50
|
|
|
|
265
|
if (!defined($data)) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
die "Please specify table data"; |
24
|
|
|
|
|
|
|
} elsif (ref($data) eq 'HASH') { |
25
|
17
|
|
|
|
|
484
|
require TableData::Object::hash; |
26
|
17
|
|
|
|
|
62
|
TableData::Object::hash->new($data); |
27
|
|
|
|
|
|
|
} elsif (is_aoaos($data, {max=>10})) { |
28
|
9
|
|
|
|
|
1267
|
require TableData::Object::aoaos; |
29
|
9
|
|
|
|
|
51
|
TableData::Object::aoaos->new($data, $spec); |
30
|
|
|
|
|
|
|
} elsif (is_aohos($data, {max=>10})) { |
31
|
8
|
|
|
|
|
1151
|
require TableData::Object::aohos; |
32
|
8
|
|
|
|
|
23
|
TableData::Object::aohos->new($data, $spec); |
33
|
|
|
|
|
|
|
} elsif (ref($data) eq 'ARRAY') { |
34
|
15
|
|
|
|
|
1612
|
require TableData::Object::aos; |
35
|
15
|
|
|
|
|
57
|
TableData::Object::aos->new($data); |
36
|
|
|
|
|
|
|
} else { |
37
|
0
|
|
|
|
|
|
die "Unknown table data form, please supply array of scalar, ". |
38
|
|
|
|
|
|
|
"array of array-of-scalar, or array of hash-of-scalar"; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
# ABSTRACT: Manipulate data structure via table object |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |