line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::TableData::Object; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
300552
|
use 5.010001; |
|
4
|
|
|
|
|
53
|
|
4
|
4
|
|
|
4
|
|
23
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
86
|
|
5
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
166
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
2326
|
use Data::Check::Structure qw(is_aos is_aoaos is_aohos); |
|
4
|
|
|
|
|
6468
|
|
|
4
|
|
|
|
|
292
|
|
8
|
4
|
|
|
4
|
|
29
|
use Exporter qw(import); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
101
|
|
9
|
4
|
|
|
4
|
|
23
|
use Scalar::Util qw(blessed); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1302
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
12
|
|
|
|
|
|
|
our $DATE = '2021-11-17'; # DATE |
13
|
|
|
|
|
|
|
our $DIST = 'Data-TableData-Object'; # DIST |
14
|
|
|
|
|
|
|
our $VERSION = '0.115'; # VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT_OK = qw(table); |
17
|
|
|
|
|
|
|
|
18
|
49
|
|
|
49
|
1
|
27170
|
sub table { __PACKAGE__->new(@_) } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
49
|
|
|
49
|
1
|
142
|
my ($class, $data, $spec) = @_; |
22
|
49
|
50
|
33
|
|
|
398
|
if (!defined($data)) { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
die "Please specify table data"; |
24
|
|
|
|
|
|
|
} elsif (blessed($data) && $data->isa("Data::TableData::Object::Base")) { |
25
|
0
|
|
|
|
|
0
|
return $data; |
26
|
|
|
|
|
|
|
} elsif (ref($data) eq 'HASH') { |
27
|
17
|
|
|
|
|
605
|
require Data::TableData::Object::hash; |
28
|
17
|
|
|
|
|
76
|
Data::TableData::Object::hash->new($data); |
29
|
|
|
|
|
|
|
} elsif (is_aoaos($data)) { |
30
|
9
|
|
|
|
|
1238
|
require Data::TableData::Object::aoaos; |
31
|
9
|
|
|
|
|
33
|
Data::TableData::Object::aoaos->new($data, $spec); |
32
|
|
|
|
|
|
|
} elsif (is_aohos($data)) { |
33
|
8
|
|
|
|
|
1543
|
require Data::TableData::Object::aohos; |
34
|
8
|
|
|
|
|
36
|
Data::TableData::Object::aohos->new($data, $spec); |
35
|
|
|
|
|
|
|
} elsif (ref($data) eq 'ARRAY') { |
36
|
15
|
|
|
|
|
1754
|
require Data::TableData::Object::aos; |
37
|
15
|
|
|
|
|
76
|
Data::TableData::Object::aos->new($data); |
38
|
|
|
|
|
|
|
} else { |
39
|
0
|
|
|
|
|
|
die "Unknown table data form, please supply array of scalar, ". |
40
|
|
|
|
|
|
|
"array of array-of-scalar, or array of hash-of-scalar"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
# ABSTRACT: Manipulate table-like data structure via table object |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |