| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
22
|
|
|
4
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
26
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package WWW::Shopify::Field::Relation; |
|
7
|
1
|
|
|
1
|
|
2
|
use parent 'WWW::Shopify::Field'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
3
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
0
|
|
|
0
|
0
|
|
my $package = shift; |
|
10
|
0
|
|
|
|
|
|
my $calling_package = caller(0); |
|
11
|
0
|
|
|
|
|
|
return bless { |
|
12
|
|
|
|
|
|
|
arguments => [@_], |
|
13
|
|
|
|
|
|
|
name => undef, |
|
14
|
|
|
|
|
|
|
owner => $calling_package, |
|
15
|
|
|
|
|
|
|
relation => $_[0] |
|
16
|
|
|
|
|
|
|
}, $package; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
0
|
|
|
0
|
0
|
|
sub relation { return $_[0]->{relation}; } |
|
19
|
0
|
|
|
0
|
0
|
|
sub is_relation { return 1; } |
|
20
|
0
|
|
|
0
|
0
|
|
sub is_many { return undef; } |
|
21
|
0
|
|
|
0
|
0
|
|
sub is_one { return undef; } |
|
22
|
0
|
|
|
0
|
0
|
|
sub is_own { return undef; } |
|
23
|
0
|
|
|
0
|
0
|
|
sub is_reference { return undef; } |
|
24
|
0
|
|
|
0
|
0
|
|
sub is_parent { return undef; } |
|
25
|
0
|
|
|
0
|
0
|
|
sub sql_type { return WWW::Shopify::Field::Identifier->sql_type(); } |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
0
|
0
|
0
|
|
sub is_db_belongs_to { return ($_[0]->is_reference && $_[0]->is_one) || ($_[0]->is_one && $_[0]->is_own && (!$_[0]->relation->parent || $_[0]->relation->parent ne $_[0]->owner )); } |
|
28
|
0
|
|
0
|
0
|
0
|
|
sub is_db_has_one { return $_[0]->is_one && $_[0]->is_own && $_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner} |
|
29
|
|
|
|
|
|
|
sub is_db_has_many { |
|
30
|
|
|
|
|
|
|
return !$_[0]->is_db_belongs_to && !$_[0]->is_db_has_one && $_[0]->is_many && ( |
|
31
|
|
|
|
|
|
|
($_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner) || |
|
32
|
|
|
|
|
|
|
($_[0]->{arguments}->[1] && ref($_[0]->{arguments}->[1]) && ref($_[0]->{arguments}->[1]) eq 'HASH' && $_[0]->{arguments}->[1]->{direct}) |
|
33
|
0
|
|
0
|
0
|
0
|
|
); } |
|
34
|
0
|
|
0
|
0
|
0
|
|
sub is_db_many_many { return !$_[0]->is_db_belongs_to && !$_[0]->is_db_has_one && !$_[0]->is_db_has_many && ($_[0]->is_many || $_[0]->is_own); } |
|
35
|
|
|
|
0
|
0
|
|
sub db_min_count { } |
|
36
|
|
|
|
0
|
0
|
|
sub db_max_count { } |
|
37
|
1
|
|
|
1
|
|
730
|
use Math::Round qw(round); |
|
|
1
|
|
|
|
|
5116
|
|
|
|
1
|
|
|
|
|
83
|
|
|
38
|
0
|
|
|
0
|
0
|
|
sub db_rand_count { return $_[0]->db_min_count + round(rand($_[0]->db_max_count - $_[0]->db_min_count)); } |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
package WWW::Shopify::Field::Relation::Parent; |
|
41
|
1
|
|
|
1
|
|
4
|
use parent 'WWW::Shopify::Field::Relation'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
42
|
0
|
|
|
0
|
|
|
sub is_parent { return 1; } |
|
43
|
0
|
|
|
0
|
|
|
sub is_reference { return 1; } |
|
44
|
0
|
|
|
0
|
|
|
sub is_one { return 1; } |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
|
|
sub db_min_count { return 1; } |
|
47
|
0
|
|
|
0
|
|
|
sub db_max_count { return 1; } |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
package WWW::Shopify::Field::Relation::Many; |
|
50
|
1
|
|
|
1
|
|
87
|
use parent 'WWW::Shopify::Field::Relation'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
2
|
|
|
51
|
0
|
|
|
0
|
|
|
sub is_many { return 1; } |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
0
|
0
|
0
|
|
|
sub db_min_count { return defined $_[0]->{arguments}->[1] && !ref($_[0]->{arguments}->[1]) ? $_[0]->{arguments}->[1] : 0; } |
|
54
|
0
|
0
|
0
|
0
|
|
|
sub db_max_count { return defined $_[0]->{arguments}->[2] && !ref($_[0]->{arguments}->[2]) ? $_[0]->{arguments}->[2] : 5; } |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
package WWW::Shopify::Field::Relation::ReferenceOne; |
|
57
|
1
|
|
|
1
|
|
113
|
use parent 'WWW::Shopify::Field::Relation'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
2
|
|
|
58
|
0
|
|
|
0
|
|
|
sub is_one { return 1; } |
|
59
|
0
|
|
|
0
|
|
|
sub is_reference { return 1; } |
|
60
|
0
|
|
|
0
|
|
|
sub data_type { return WWW::Shopify::Field->TYPE_QUANTITATIVE; } |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
0
|
0
|
0
|
|
|
sub db_min_count { return defined $_[0]->{arguments}->[1] && !ref($_[0]->{arguments}->[1]) ? $_[0]->{arguments}->[1] : 0; } |
|
63
|
0
|
|
|
0
|
|
|
sub db_max_count { return 1; } |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
package WWW::Shopify::Field::Relation::OwnOne; |
|
66
|
1
|
|
|
1
|
|
119
|
use parent 'WWW::Shopify::Field::Relation'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
67
|
0
|
|
|
0
|
|
|
sub is_one { return 1; } |
|
68
|
0
|
|
|
0
|
|
|
sub is_own { return 1; } |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
0
|
0
|
0
|
|
|
sub db_min_count { return defined $_[0]->{arguments}->[1] && !ref($_[0]->{arguments}->[1]) ? $_[0]->{arguments}->[1] : 0; } |
|
71
|
0
|
|
|
0
|
|
|
sub db_max_count { return 1; } |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |