line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TableData::Object; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2019-09-15'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.111'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
1861
|
use 5.010001; |
|
4
|
|
|
|
|
28
|
|
7
|
4
|
|
|
4
|
|
17
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
86
|
|
8
|
4
|
|
|
4
|
|
16
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
163
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
1682
|
use Data::Check::Structure qw(is_aos is_aoaos is_aohos); |
|
4
|
|
|
|
|
3517
|
|
|
4
|
|
|
|
|
1007
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter; |
13
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(table); |
15
|
|
|
|
|
|
|
|
16
|
49
|
|
|
49
|
1
|
22264
|
sub table { __PACKAGE__->new(@_) } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
49
|
|
|
49
|
1
|
106
|
my ($class, $data, $spec) = @_; |
20
|
49
|
50
|
|
|
|
247
|
if (!defined($data)) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
die "Please specify table data"; |
22
|
|
|
|
|
|
|
} elsif (ref($data) eq 'HASH') { |
23
|
17
|
|
|
|
|
496
|
require TableData::Object::hash; |
24
|
17
|
|
|
|
|
44
|
TableData::Object::hash->new($data); |
25
|
|
|
|
|
|
|
} elsif (is_aoaos($data, {max=>10})) { |
26
|
9
|
|
|
|
|
1045
|
require TableData::Object::aoaos; |
27
|
9
|
|
|
|
|
34
|
TableData::Object::aoaos->new($data, $spec); |
28
|
|
|
|
|
|
|
} elsif (is_aohos($data, {max=>10})) { |
29
|
8
|
|
|
|
|
1148
|
require TableData::Object::aohos; |
30
|
8
|
|
|
|
|
33
|
TableData::Object::aohos->new($data, $spec); |
31
|
|
|
|
|
|
|
} elsif (ref($data) eq 'ARRAY') { |
32
|
15
|
|
|
|
|
963
|
require TableData::Object::aos; |
33
|
15
|
|
|
|
|
47
|
TableData::Object::aos->new($data); |
34
|
|
|
|
|
|
|
} else { |
35
|
0
|
|
|
|
|
|
die "Unknown table data form, please supply array of scalar, ". |
36
|
|
|
|
|
|
|
"array of array-of-scalar, or array of hash-of-scalar"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
# ABSTRACT: Manipulate data structure via table object |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |