line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
package Net::Braintree::AdvancedSearchNodes; |
3
|
1
|
|
|
1
|
|
4
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
{ |
7
|
|
|
|
|
|
|
package Net::Braintree::SearchNode; |
8
|
1
|
|
|
1
|
|
7523
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'searcher' => (is => 'rw'); |
11
|
|
|
|
|
|
|
has 'name' => (is => 'rw'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'criteria' => (is => 'rw', default => sub {shift->default_criteria()}); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub default_criteria { |
16
|
0
|
|
|
0
|
0
|
|
return {}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub active { |
20
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
return %{$self->criteria}; |
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub add_node { |
25
|
0
|
|
|
0
|
0
|
|
my ($self, $operator, $operand) = @_; |
26
|
0
|
|
|
|
|
|
$self->criteria->{$operator} = $operand; |
27
|
0
|
|
|
|
|
|
return $self->searcher; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
package Net::Braintree::IsNode; |
35
|
1
|
|
|
1
|
|
5457
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
36
|
|
|
|
|
|
|
extends ("Net::Braintree::SearchNode"); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub is { |
39
|
0
|
|
|
0
|
0
|
|
my ($self, $operand) = @_; |
40
|
0
|
|
|
|
|
|
return $self->add_node("is", $operand); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
{ |
46
|
|
|
|
|
|
|
package Net::Braintree::EqualityNode; |
47
|
1
|
|
|
1
|
|
5297
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
48
|
|
|
|
|
|
|
extends ("Net::Braintree::IsNode"); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub is_not { |
51
|
0
|
|
|
0
|
0
|
|
my ($self, $operand) = @_; |
52
|
0
|
|
|
|
|
|
return $self->add_node("is_not", $operand); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
package Net::Braintree::KeyValueNode; |
59
|
1
|
|
|
1
|
|
5340
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
60
|
|
|
|
|
|
|
extends ("Net::Braintree::SearchNode"); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub default_criteria { |
63
|
0
|
|
|
0
|
0
|
|
return ""; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub active { |
67
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
68
|
0
|
|
|
|
|
|
return $self->criteria; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub is { |
72
|
0
|
|
|
0
|
0
|
|
my ($self, $operand) = @_; |
73
|
0
|
|
|
|
|
|
$self->criteria($operand); |
74
|
0
|
|
|
|
|
|
return $self->searcher; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
{ |
80
|
|
|
|
|
|
|
package Net::Braintree::PartialMatchNode; |
81
|
1
|
|
|
1
|
|
4990
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
82
|
|
|
|
|
|
|
extends ("Net::Braintree::EqualityNode"); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub starts_with { |
85
|
0
|
|
|
0
|
0
|
|
my ($self, $operand) = @_; |
86
|
0
|
|
|
|
|
|
return $self->add_node("starts_with", $operand); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub ends_with { |
90
|
0
|
|
|
0
|
0
|
|
my ($self, $operand) = @_; |
91
|
0
|
|
|
|
|
|
return $self->add_node("ends_with", $operand); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
{ |
97
|
|
|
|
|
|
|
package Net::Braintree::TextNode; |
98
|
1
|
|
|
1
|
|
5062
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
99
|
|
|
|
|
|
|
extends ("Net::Braintree::PartialMatchNode"); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub contains { |
102
|
0
|
|
|
0
|
0
|
|
my ($self, $operand) = @_; |
103
|
0
|
|
|
|
|
|
return $self->add_node("contains", $operand); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
{ |
109
|
|
|
|
|
|
|
package Net::Braintree::RangeNode; |
110
|
1
|
|
|
1
|
|
5250
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
111
|
|
|
|
|
|
|
extends ("Net::Braintree::EqualityNode"); |
112
|
|
|
|
|
|
|
|
113
|
1
|
|
|
1
|
|
4968
|
use overload ( '>=' => 'min', '<=' => 'max'); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub min { |
116
|
0
|
|
|
0
|
0
|
|
my ($self, $operand) = @_; |
117
|
0
|
|
|
|
|
|
return $self->add_node("min", $operand); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub max { |
121
|
0
|
|
|
0
|
0
|
|
my ($self, $operand) = @_; |
122
|
0
|
|
|
|
|
|
return $self->add_node("max", $operand); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub between { |
126
|
0
|
|
|
0
|
0
|
|
my ($self, $min, $max) = @_; |
127
|
0
|
|
|
|
|
|
$self->max($max); |
128
|
0
|
|
|
|
|
|
$self->min($min); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
{ |
135
|
|
|
|
|
|
|
package Net::Braintree::MultipleValuesNode; |
136
|
1
|
|
|
1
|
|
227
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
100
|
|
137
|
1
|
|
|
1
|
|
6
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
138
|
1
|
|
|
1
|
|
5401
|
use Net::Braintree::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
549
|
|
139
|
|
|
|
|
|
|
extends ("Net::Braintree::SearchNode"); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
has 'allowed_values' => (is => 'rw'); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub default_criteria { |
144
|
0
|
|
|
0
|
0
|
|
return []; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub active { |
148
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
149
|
0
|
|
|
|
|
|
return @{$self->criteria}; |
|
0
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub is { |
153
|
0
|
|
|
0
|
0
|
|
shift->in(@_); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub _args_to_array { |
157
|
0
|
|
|
0
|
|
|
my $self = shift; |
158
|
0
|
|
|
|
|
|
my @args; |
159
|
0
|
0
|
|
|
|
|
if (ref($_[0]) eq 'ARRAY') { |
160
|
0
|
|
|
|
|
|
@args = @{$_[0]}; |
|
0
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
} else { |
162
|
0
|
|
|
|
|
|
@args = @_; |
163
|
|
|
|
|
|
|
} |
164
|
0
|
|
|
|
|
|
return @args; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub in { |
168
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
169
|
0
|
|
|
|
|
|
my @values = $self->_args_to_array(@_); |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
my $bad_values = difference_arrays(\@values, $self->allowed_values); |
172
|
|
|
|
|
|
|
|
173
|
0
|
0
|
0
|
|
|
|
if (@$bad_values && $self->allowed_values) { |
174
|
0
|
|
|
|
|
|
croak "Invalid Argument(s) for " . $self->name . ": " . join(", ", @$bad_values); |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
0
|
|
|
|
|
|
@{$self->criteria} = @values; |
|
0
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
return $self->searcher; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |
182
|
|
|
|
|
|
|
} |