Simple.pm

filter: Statementstmt 97.7% 469 / 480 Branchbran 83.3% 125 / 150 Conditioncond 60.0% 30 / 50 MC/DCmcdc 31.2% 10 / 32 Subroutinesub 99.1% 119 / 120 Podpod 100% 22 / 22 totaltotal 90.7% 775 / 854 CC 98 SCAR 13.4
CC
98
Cov
92%
_encode_params
16.5
_make_request
9.3
data_object
9.1
CRAP 3.8
« Simple/Error.pm ↑ Summary Simple/Data.pm »
1 package Net::Stripe::Simple;
2 4 $Net::Stripe::Simple::VERSION = '0.006';
3 # ABSTRACT: simple, non-Moose interface to the Stripe API
4  
5 4 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use HTTP::Request::Common qw(GET POST DELETE);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use MIME::Base64 qw(encode_base64);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use URI::Escape qw(uri_escape uri_escape_utf8);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use Scalar::Util qw(reftype blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use JSON ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 4 ▶use Devel::StackTrace;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 4 ▶use Net::Stripe::Simple::Data;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 4 ▶use Net::Stripe::Simple::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 4 our @EXPORT_OK = qw(true false null data_object);
22 4 our %EXPORT_TAGS = ( const => [qw(true false null)], all => \@EXPORT_OK );
23  
24 4 ▶use constant API_BASE => 'https://api.stripe.com/v1';
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 # version of stripe's API to use
27 4 our $STRIPE_VERSION = '2014-06-17';
28  
29  
30 1 ▶sub new {
Subroutine new: called CC=5 SCAR=17.6
Pod documented
31 1 my ( $class, $api, $version ) = @_;
32 1 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
33 1 ▶ die 'API key required' unless $api;
Branch: 1 branch
BranchTrueFalseTotal
unless $api 0 1 1
34 1 ▶ $version //= $STRIPE_VERSION;
Condition33%1/3
$version //= $Net::Stripe::Simple::STRIPE_VERSION
l!l&&r!l&&!r
100
MC/DC0%0/2
$version //= $Net::Stripe::Simple::STRIPE_VERSION
$version $Net::Stripe::Simple::STRIPE_VERSION
Truth table33%1/3
A //= B
A= $versionB= $Net::Stripe::Simple::STRIPE_VERSION
ABresult
1X1
011
000
35  
36 1 ▶ my $pkg_version = $Net::Stripe::Simple::VERSION // '0.01';
Condition50%1/2
$Net::Stripe::Simple::VERSION // "0.01"
l!l
10
MC/DC0%0/1
$Net::Stripe::Simple::VERSION // "0.01"
$Net::Stripe::Simple::VERSION
Truth table50%1/2
A
A= $Net::Stripe::Simple::VERSION
Aresult
11
00
37  
38 1 my $ua = LWP::UserAgent->new;
39 1 $ua->agent("$class/$pkg_version");
40 1 my $auth = 'Basic ' . encode_base64( $api . ':' );
41 1 bless { ua => $ua, auth => $auth, version => $version }, $class;
42 }
43  
44 # API
45  
46 # generic argument validation
47 139 ▶sub _validate {
Subroutine _validate: called CC=7 SCAR=19.8
48 139 my $self = shift;
49 139 my $name = shift;
50 139 my $actions = shift;
51 139 my $action = shift;
52 139 ( my $err_name = $name ) =~ tr/_/ /;
53 139 ▶ my $args = ref $_[0] eq 'HASH' ? $_[0] : { @_ == 1 ? ( id => $_[0] ) : @_ };
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 77 62 139
@_ == 1 ? : 32 30 62
54 139 ▶ die "$err_name action required" unless $action;
Branch: 1 branch
BranchTrueFalseTotal
unless $action 0 139 139
55 139 ▶ die "unknown $err_name action: $action" unless exists $actions->{$action};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $actions->{$action} 0 139 139
56 139 ▶ my $method = $actions->{$action} //= $self->can("_${action}_$name");
Condition66%2/3
$actions->{$action} //= $self->can("_${action}_$name")
l!l&&r!l&&!r
71680
MC/DC0%0/2
$actions->{$action} //= $self->can("_${action}_$name")
$actions->{$action} $self->can("_${action}_$name")
Truth table66%2/3
A //= B
A= $actions->{$action}B= $self->can("_${action}_$name")
ABresult
1X1
011
000
57 139 ▶ die "logic error: $action $err_name action not implemented" unless $method;
Branch: 1 branch
BranchTrueFalseTotal
unless $method 0 139 139
58 139 return $args, $method;
59 }
60  
61 # removes private keys from args
62 55 ▶sub _clean {
Subroutine _clean: called CC=1 SCAR=0.0
63 55 my $args = shift;
64 55 delete @$args{ grep /^_/, keys %$args };
65 }
66  
67 # generic implementations of these operations
68  
69 21 ▶sub _retrieve {
Subroutine _retrieve: called CC=2 SCAR=6.9
70 21 my ( $self, $args ) = @_;
71 21 my ( $base, $id ) = @$args{qw(_base id)};
72 21 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 10 11 21
73 11 return $self->_get( $base . '/' . uri_escape($id) );
74 }
75  
76 12 ▶sub _update {
Subroutine _update: called CC=2 SCAR=6.9
77 12 my ( $self, $args ) = @_;
78 12 my ( $base, $id ) = delete @$args{qw(_base id)};
79 12 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 6 6 12
80 6 _clean($args);
81 6 return $self->_post( $base . '/' . uri_escape($id), $args );
82 }
83  
84 15 ▶sub _create {
Subroutine _create: called CC=1 SCAR=0.0
85 15 my ( $self, $args ) = @_;
86 15 my $base = delete $args->{_base};
87 15 _clean($args);
88 15 return $self->_post( $base, $args );
89 }
90  
91 10 ▶sub _list {
Subroutine _list: called CC=1 SCAR=0.0
92 10 my ( $self, $args ) = @_;
93 10 my $base = delete $args->{_base};
94 10 _clean($args);
95 10 return $self->_get( $base, $args );
96 }
97  
98 13 ▶sub _del {
Subroutine _del: called CC=2 SCAR=6.9
99 13 my ( $self, $args ) = @_;
100 13 my ( $base, $id ) = @$args{qw(_base id)};
101 13 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 4 9 13
102 9 return $self->_delete( $base . '/' . uri_escape($id) );
103 }
104  
105 # create a common uri base; expects customer id and sub-base
106 23 ▶sub _customer_base {
Subroutine _customer_base: called CC=2 SCAR=6.9
107 23 my $customer = shift;
108 23 ▶ _invalid('No customer id provided.') unless defined $customer;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $customer 4 19 23
109 19 return 'customers/' . uri_escape($customer) . '/' . shift;
110 }
111  
112  
113 9 ▶sub charges {
Subroutine charges: called CC=1 SCAR=0.0
Pod documented
114 9 my $self = shift;
115 state $actions =
116 9 { map { $_ => undef } qw(create retrieve update refund capture list) };
117 9 my ( $args, $method ) = $self->_validate( 'charge', $actions, @_ );
118 9 $args->{_base} = 'charges';
119 9 return $self->$method($args);
120 }
121 1 ▶sub _create_charge { goto &_create }
Subroutine _create_charge: called CC=1 SCAR=0.0
122 2 ▶sub _retrieve_charge { goto &_retrieve }
Subroutine _retrieve_charge: called CC=1 SCAR=0.0
123 2 ▶sub _update_charge { goto &_update }
Subroutine _update_charge: called CC=1 SCAR=0.0
124  
125 2 ▶sub _capture_charge {
Subroutine _capture_charge: called CC=2 SCAR=6.9
126 2 my ( $self, $args ) = @_;
127 2 my ( $base, $id ) = delete @$args{qw(_base id)};
128 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
129 1 _clean($args);
130 1 return $self->_post( $base . '/' . uri_escape($id) . '/capture', $args );
131 }
132 2 ▶sub _list_charge { goto &_list }
Subroutine _list_charge: called CC=1 SCAR=0.0
133  
134 0 ▶sub _refund_charge {
Subroutine _refund_charge: not called CC=2 SCAR=17.9
135 0 my ( $self, $args ) = @_;
136 0 my ( $base, $id ) = delete @$args{qw(_base id)};
137 0 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 0 0
138 0 _clean($args);
139 0 return $self->_post( $base . '/' . uri_escape($id) . '/refund', $args );
140 }
141  
142  
143 7 ▶sub refunds {
Subroutine refunds: called CC=1 SCAR=0.0
Pod documented
144 7 my $self = shift;
145 7 state $actions = { map { $_ => undef } qw(create retrieve update list) };
146 7 my ( $args, $method ) = $self->_validate( 'refund', $actions, @_ );
147 7 $args->{_base} = 'charges';
148 7 return $self->$method($args);
149 }
150  
151 2 ▶sub _create_refund {
Subroutine _create_refund: called CC=2 SCAR=6.9
152 2 my ( $self, $args ) = @_;
153 2 my ( $base, $id ) = delete @$args{qw(_base id)};
154 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
155 1 _clean($args);
156 1 return $self->_post( $base . '/' . uri_escape($id) . '/refunds', $args );
157 }
158  
159 2 ▶sub _retrieve_refund {
Subroutine _retrieve_refund: called CC=4 SCAR=13.9
160 2 my ( $self, $args ) = @_;
161 2 my ( $base, $id, $charge ) = delete @$args{qw(_base id charge)};
162 2 my @errors;
163 2 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
164 2 ▶ push @errors, 'No charge provided.' unless defined $charge;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $charge 0 2 2
165 2 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 1 1 2
166 1 _clean($args);
167 1 return $self->_get(
168 $base . '/' . uri_escape($charge) . '/refunds/' . uri_escape($id),
169 $args );
170 }
171  
172 2 ▶sub _update_refund {
Subroutine _update_refund: called CC=4 SCAR=13.9
173 2 my ( $self, $args ) = @_;
174 2 my ( $base, $id, $charge ) = delete @$args{qw(_base id charge)};
175 2 my @errors;
176 2 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
177 2 ▶ push @errors, 'No charge provided.' unless defined $charge;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $charge 0 2 2
178 2 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 1 1 2
179 1 _clean($args);
180 1 return $self->_post(
181 $base . '/' . uri_escape($charge) . '/refunds/' . uri_escape($id),
182 $args );
183 }
184  
185 1 ▶sub _list_refund {
Subroutine _list_refund: called CC=2 SCAR=7.0
186 1 my ( $self, $args ) = @_;
187 1 my ( $base, $id ) = delete @$args{qw(_base id)};
188 1 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 1 1
189 1 _clean($args);
190 1 return $self->_get( $base . '/' . uri_escape($id) . '/refunds', $args );
191 }
192  
193  
194 13 ▶sub customers {
Subroutine customers: called CC=1 SCAR=0.0
Pod documented
195 13 my $self = shift;
196 state $actions =
197 13 { map { $_ => undef } qw(create retrieve update delete list) };
198 13 my ( $args, $method ) = $self->_validate( 'customer', $actions, @_ );
199 13 $args->{_base} = 'customers';
200 13 return $self->$method($args);
201 }
202 3 ▶sub _create_customer { goto &_create }
Subroutine _create_customer: called CC=1 SCAR=0.0
203 3 ▶sub _retrieve_customer { goto &_retrieve }
Subroutine _retrieve_customer: called CC=1 SCAR=0.0
204 2 ▶sub _update_customer { goto &_update }
Subroutine _update_customer: called CC=1 SCAR=0.0
205 4 ▶sub _delete_customer { goto &_del }
Subroutine _delete_customer: called CC=1 SCAR=0.0
206 1 ▶sub _list_customer { goto &_list }
Subroutine _list_customer: called CC=1 SCAR=0.0
207  
208  
209 10 ▶sub payment_intents {
Subroutine payment_intents: called CC=1 SCAR=0.0
Pod documented
210 10 my $self = shift;
211 state $actions =
212 10 { map { $_ => undef } qw(create retrieve update confirm capture cancel list) };
213 10 my ( $args, $method ) = $self->_validate( 'payment_intent', $actions, @_ );
214 10 $args->{_base} = 'payment_intents';
215 10 return $self->$method($args);
216 }
217 1 ▶sub _create_payment_intent { goto &_create }
Subroutine _create_payment_intent: called CC=1 SCAR=0.0
218 2 ▶sub _retrieve_payment_intent { goto &_retrieve }
Subroutine _retrieve_payment_intent: called CC=1 SCAR=0.0
219 2 ▶sub _update_payment_intent { goto &_update }
Subroutine _update_payment_intent: called CC=1 SCAR=0.0
220 1 ▶sub _confirm_payment_intent {
Subroutine _confirm_payment_intent: called CC=2 SCAR=7.0
221 1 my ( $self, $args ) = @_;
222 1 my ( $base, $id ) = @$args{qw(_base id)};
223 1 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 1 1
224 1 my $path = $base . '/' . uri_escape($id) . '/confirm';
225 1 return $self->_post($path);
226 }
227 1 ▶sub _capture_payment_intent {
Subroutine _capture_payment_intent: called CC=2 SCAR=7.0
228 1 my ( $self, $args ) = @_;
229 1 my ( $base, $id ) = @$args{qw(_base id)};
230 1 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 1 1
231 1 my $path = $base . '/' . uri_escape($id) . '/capture';
232 1 return $self->_post($path);
233 }
234 2 ▶sub _cancel_payment_intent {
Subroutine _cancel_payment_intent: called CC=2 SCAR=6.9
235 2 my ( $self, $args ) = @_;
236 2 my ( $base, $id ) = @$args{qw(_base id)};
237 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
238 1 my $path = $base . '/' . uri_escape($id) . '/cancel';
239 1 return $self->_post($path);
240 }
241 1 ▶sub _list_payment_intent { goto &_list }
Subroutine _list_payment_intent: called CC=1 SCAR=0.0
242  
243  
244 15 ▶sub cards {
Subroutine cards: called CC=1 SCAR=0.0
Pod documented
245 15 my $self = shift;
246 state $actions =
247 15 { map { $_ => undef } qw(create retrieve update delete list) };
248 15 my ( $args, $method ) = $self->_validate( 'card', $actions, @_ );
249 15 $args->{_base} = 'cards';
250 15 return $self->$method($args);
251 }
252  
253 4 ▶sub _create_card {
Subroutine _create_card: called CC=2 SCAR=7.0
254 4 my ( $self, $args ) = @_;
255 4 my ( $base, $id, $customer ) = delete @$args{qw(_base id customer)};
256 4 ▶ $id //= $customer;
Condition66%2/3
$id //= $customer
l!l&&r!l&&!r
031
MC/DC50%1/2
$id //= $customer
$id $customer
Truth table66%2/3
A //= B
A= $idB= $customer
ABresult
1X1
011
000
257 4 _clean($args);
258 4 return $self->_post( _customer_base( $id, $base ), $args );
259 }
260  
261 3 ▶sub _retrieve_card {
Subroutine _retrieve_card: called CC=4 SCAR=13.9
262 3 my ( $self, $args ) = @_;
263 3 my ( $base, $id, $customer ) = @$args{qw(_base id customer)};
264 3 my @errors;
265 3 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 2 3
266 3 ▶ push @errors, 'No customer id provided.' unless defined $customer;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $customer 1 2 3
267 3 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 2 1 3
268 1 return $self->_get(
269 _customer_base( $customer, $base ) . '/' . uri_escape($id) );
270 }
271  
272 3 ▶sub _update_card {
Subroutine _update_card: called CC=4 SCAR=13.9
273 3 my ( $self, $args ) = @_;
274 3 my ( $base, $id, $customer ) = delete @$args{qw(_base id customer)};
275 3 my @errors;
276 3 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 2 3
277 3 ▶ push @errors, 'No customer id provided.' unless defined $customer;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $customer 1 2 3
278 3 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 2 1 3
279 1 _clean($args);
280 1 return $self->_post(
281 _customer_base( $customer, $base ) . '/' . uri_escape($id), $args );
282 }
283  
284 3 ▶sub _delete_card {
Subroutine _delete_card: called CC=4 SCAR=13.9
285 3 my ( $self, $args ) = @_;
286 3 my ( $base, $id, $customer ) = @$args{qw(_base id customer)};
287 3 my @errors;
288 3 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 2 3
289 3 ▶ push @errors, 'No customer id provided.' unless defined $customer;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $customer 1 2 3
290 3 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 2 1 3
291 1 return $self->_delete(
292 _customer_base( $customer, $base ) . '/' . uri_escape($id) );
293 }
294  
295 2 ▶sub _list_card {
Subroutine _list_card: called CC=2 SCAR=7.0
296 2 my ( $self, $args ) = @_;
297 2 my ( $base, $id, $customer ) = delete @$args{qw(_base id customer)};
298 2 ▶ $id //= $customer;
Condition66%2/3
$id //= $customer
l!l&&r!l&&!r
101
MC/DC50%1/2
$id //= $customer
$id $customer
Truth table66%2/3
A //= B
A= $idB= $customer
ABresult
1X1
011
000
299 2 _clean($args);
300 2 return $self->_get( _customer_base( $id, $base ), $args );
301 }
302  
303  
304 17 ▶sub subscriptions {
Subroutine subscriptions: called CC=1 SCAR=0.0
Pod documented
305 17 my $self = shift;
306 state $actions =
307 17 { map { $_ => undef } qw(create retrieve update cancel list) };
308 17 my ( $args, $method ) = $self->_validate( 'subscription', $actions, @_ );
309 17 $args->{_base} = 'subscriptions';
310 17 return $self->$method($args);
311 }
312  
313 4 ▶sub _create_subscription {
Subroutine _create_subscription: called CC=2 SCAR=7.0
314 4 my ( $self, $args ) = @_;
315 4 my ( $base, $id, $customer ) = delete @$args{qw(_base id customer)};
316 4 ▶ $id //= $customer;
Condition66%2/3
$id //= $customer
l!l&&r!l&&!r
031
MC/DC50%1/2
$id //= $customer
$id $customer
Truth table66%2/3
A //= B
A= $idB= $customer
ABresult
1X1
011
000
317 4 _clean($args);
318 4 return $self->_post( _customer_base( $id, $base ), $args );
319 }
320  
321 3 ▶sub _retrieve_subscription {
Subroutine _retrieve_subscription: called CC=4 SCAR=13.9
322 3 my ( $self, $args ) = @_;
323 3 my ( $base, $id, $customer ) = @$args{qw(_base id customer)};
324 3 my @errors;
325 3 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 2 3
326 3 ▶ push @errors, 'No customer id provided.' unless defined $customer;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $customer 1 2 3
327 3 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 2 1 3
328 1 return $self->_get(
329 _customer_base( $customer, $base ) . '/' . uri_escape($id) );
330 }
331  
332 4 ▶sub _update_subscription {
Subroutine _update_subscription: called CC=4 SCAR=13.9
333 4 my ( $self, $args ) = @_;
334 4 my ( $base, $id, $customer ) = delete @$args{qw(_base id customer)};
335 4 my @errors;
336 4 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 3 4
337 4 ▶ push @errors, 'No customer id provided.' unless defined $customer;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $customer 1 3 4
338 4 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 2 2 4
339 2 _clean($args);
340 2 return $self->_post(
341 _customer_base( $customer, $base ) . '/' . uri_escape($id), $args );
342 }
343  
344 5 ▶sub _cancel_subscription {
Subroutine _cancel_subscription: called CC=4 SCAR=13.9
345 5 my ( $self, $args ) = @_;
346 5 my ( $base, $id, $customer ) = @$args{qw(_base id customer)};
347 5 my @errors;
348 5 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 4 5
349 5 ▶ push @errors, 'No customer id provided.' unless defined $customer;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $customer 1 4 5
350 5 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 2 3 5
351 3 return $self->_delete(
352 _customer_base( $customer, $base ) . '/' . uri_escape($id) );
353 }
354  
355 1 ▶sub _list_subscription {
Subroutine _list_subscription: called CC=2 SCAR=7.2
356 1 my ( $self, $args ) = @_;
357 1 my ( $base, $id, $customer ) = delete @$args{qw(_base id customer)};
358 1 ▶ $id //= $customer;
Condition33%1/3
$id //= $customer
l!l&&r!l&&!r
100
MC/DC0%0/2
$id //= $customer
$id $customer
Truth table33%1/3
A //= B
A= $idB= $customer
ABresult
1X1
011
000
359 1 _clean($args);
360 1 return $self->_get( _customer_base( $id, $base ), $args );
361 }
362  
363  
364 12 ▶sub plans {
Subroutine plans: called CC=1 SCAR=0.0
Pod documented
365 12 my $self = shift;
366 state $actions =
367 12 { map { $_ => undef } qw(create retrieve update delete list) };
368 12 my ( $args, $method ) = $self->_validate( 'plan', $actions, @_ );
369 12 $args->{_base} = 'plans';
370 12 return $self->$method($args);
371 }
372 3 ▶sub _create_plan { goto &_create }
Subroutine _create_plan: called CC=1 SCAR=0.0
373 2 ▶sub _retrieve_plan { goto &_retrieve }
Subroutine _retrieve_plan: called CC=1 SCAR=0.0
374 2 ▶sub _update_plan { goto &_update }
Subroutine _update_plan: called CC=1 SCAR=0.0
375 4 ▶sub _delete_plan { goto &_del }
Subroutine _delete_plan: called CC=1 SCAR=0.0
376 1 ▶sub _list_plan { goto &_list }
Subroutine _list_plan: called CC=1 SCAR=0.0
377  
378  
379 8 ▶sub coupons {
Subroutine coupons: called CC=1 SCAR=0.0
Pod documented
380 8 my $self = shift;
381 8 state $actions = { map { $_ => undef } qw(create retrieve delete list) };
382 8 my ( $args, $method ) = $self->_validate( 'coupon', $actions, @_ );
383 8 $args->{_base} = 'coupons';
384 8 return $self->$method($args);
385 }
386 2 ▶sub _create_coupon { goto &_create }
Subroutine _create_coupon: called CC=1 SCAR=0.0
387 2 ▶sub _retrieve_coupon { goto &_retrieve }
Subroutine _retrieve_coupon: called CC=1 SCAR=0.0
388 3 ▶sub _delete_coupon { goto &_del }
Subroutine _delete_coupon: called CC=1 SCAR=0.0
389 1 ▶sub _list_coupon { goto &_list }
Subroutine _list_coupon: called CC=1 SCAR=0.0
390  
391  
392 5 ▶sub discounts {
Subroutine discounts: called CC=1 SCAR=0.0
Pod documented
393 5 my $self = shift;
394 5 state $actions = { map { $_ => undef } qw(customer subscription) };
395 5 my ( $args, $method ) = $self->_validate( 'discount', $actions, @_ );
396 5 return $self->$method($args);
397 }
398  
399 2 ▶sub _customer_discount {
Subroutine _customer_discount: called CC=2 SCAR=7.0
400 2 my ( $self, $args ) = @_;
401 2 my ( $id, $customer ) = @$args{qw(id customer)};
402 2 ▶ $id //= $customer;
Condition66%2/3
$id //= $customer
l!l&&r!l&&!r
101
MC/DC50%1/2
$id //= $customer
$id $customer
Truth table66%2/3
A //= B
A= $idB= $customer
ABresult
1X1
011
000
403 2 return $self->_delete( _customer_base( $id, 'discount' ) );
404 }
405  
406 3 ▶sub _subscription_discount {
Subroutine _subscription_discount: called CC=4 SCAR=13.9
407 3 my ( $self, $args ) = @_;
408 3 my ( $id, $customer ) = @$args{qw(subscription customer)};
409 3 my @errors;
410 3 ▶ push @errors, 'No id provided.' unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 2 3
411 3 ▶ push @errors, 'No customer id provided.' unless defined $customer;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $customer 1 2 3
412 3 ▶ _invalid( join ' ', @errors ) if @errors;
Branch: 1 branch
BranchTrueFalseTotal
if @errors 2 1 3
413 1 my $path =
414 _customer_base( $customer, 'subscriptions' ) . '/'
415 . uri_escape($id)
416 . '/discount';
417 1 return $self->_delete($path);
418 }
419  
420  
421 13 ▶sub invoices {
Subroutine invoices: called CC=1 SCAR=0.0
Pod documented
422 13 my $self = shift;
423 state $actions =
424 13 { map { $_ => undef }
425 qw(create retrieve lines update pay list upcoming) };
426 13 my ( $args, $method ) = $self->_validate( 'invoice', $actions, @_ );
427 13 $args->{_base} = 'invoices';
428 13 return $self->$method($args);
429 }
430 1 ▶sub _create_invoice { goto &_create }
Subroutine _create_invoice: called CC=1 SCAR=0.0
431 2 ▶sub _retrieve_invoice { goto &_retrieve }
Subroutine _retrieve_invoice: called CC=1 SCAR=0.0
432  
433 2 ▶sub _lines_invoice {
Subroutine _lines_invoice: called CC=2 SCAR=6.9
434 2 my ( $self, $args ) = @_;
435 2 my ( $base, $id ) = delete @$args{qw(_base id)};
436 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
437 1 _clean($args);
438 1 return $self->_get( $base . '/' . uri_escape($id) . '/lines', $args );
439 }
440 2 ▶sub _update_invoice { goto &_update }
Subroutine _update_invoice: called CC=1 SCAR=0.0
441  
442 2 ▶sub _pay_invoice {
Subroutine _pay_invoice: called CC=2 SCAR=6.9
443 2 my ( $self, $args ) = @_;
444 2 my ( $base, $id ) = @$args{qw(_base id)};
445 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
446 1 return $self->_post( $base . '/' . uri_escape($id) . '/pay' );
447 }
448 1 ▶sub _list_invoice { goto &_list }
Subroutine _list_invoice: called CC=1 SCAR=0.0
449  
450 3 ▶sub _upcoming_invoice {
Subroutine _upcoming_invoice: called CC=3 SCAR=11.0
451 3 my ( $self, $args ) = @_;
452 3 my ( $base, $id, $customer ) = @$args{qw(_base id customer)};
453 3 ▶ $id //= $customer;
Condition66%2/3
$id //= $customer
l!l&&r!l&&!r
201
MC/DC50%1/2
$id //= $customer
$id $customer
Truth table66%2/3
A //= B
A= $idB= $customer
ABresult
1X1
011
000
454 3 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 2 3
455 2 return $self->_get( $base . '/upcoming', { customer => $id } );
456 }
457  
458  
459 8 ▶sub invoice_items {
Subroutine invoice_items: called CC=1 SCAR=0.0
Pod documented
460 8 my $self = shift;
461 state $actions =
462 8 { map { $_ => undef } qw(create retrieve update delete list) };
463 8 my ( $args, $method ) = $self->_validate( 'invoice_item', $actions, @_ );
464 8 $args->{_base} = 'invoiceitems';
465 8 return $self->$method($args);
466 }
467 1 ▶sub _create_invoice_item { goto &_create }
Subroutine _create_invoice_item: called CC=1 SCAR=0.0
468 2 ▶sub _retrieve_invoice_item { goto &_retrieve }
Subroutine _retrieve_invoice_item: called CC=1 SCAR=0.0
469 2 ▶sub _update_invoice_item { goto &_update }
Subroutine _update_invoice_item: called CC=1 SCAR=0.0
470 2 ▶sub _delete_invoice_item { goto &_del }
Subroutine _delete_invoice_item: called CC=1 SCAR=0.0
471 1 ▶sub _list_invoice_item { goto &_list }
Subroutine _list_invoice_item: called CC=1 SCAR=0.0
472  
473  
474 4 ▶sub disputes {
Subroutine disputes: called CC=1 SCAR=0.0
Pod documented
475 4 my $self = shift;
476 4 state $actions = { map { $_ => undef } qw(update close) };
477 4 my ( $args, $method ) = $self->_validate( 'dispute', $actions, @_ );
478 4 return $self->$method($args);
479 }
480  
481 2 ▶sub _update_dispute {
Subroutine _update_dispute: called CC=2 SCAR=6.9
482 2 my ( $self, $args ) = @_;
483 2 my $id = delete $args->{id};
484 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
485 1 _clean($args);
486 1 my $path = 'charges/' . uri_escape($id) . '/dispute';
487 1 return $self->_post( $path, $args );
488 }
489  
490 2 ▶sub _close_dispute {
Subroutine _close_dispute: called CC=2 SCAR=6.9
491 2 my ( $self, $args ) = @_;
492 2 my $id = delete $args->{id};
493 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
494 1 _clean($args);
495 1 my $path = 'charges/' . uri_escape($id) . '/dispute/close';
496 1 return $self->_post( $path, $args );
497 }
498  
499  
500 5 ▶sub application_fees {
Subroutine application_fees: called CC=1 SCAR=0.0
Pod documented
501 5 my $self = shift;
502 5 state $actions = { map { $_ => undef } qw(retrieve refund list) };
503 5 my ( $args, $method ) = $self->_validate( 'application_fee', $actions, @_ );
504 5 $args->{_base} = 'application_fees';
505 5 return $self->$method($args);
506 }
507  
508 2 ▶sub _retrieve_application_fee { goto &_retrieve }
Subroutine _retrieve_application_fee: called CC=1 SCAR=0.0
509 1 ▶sub _list_application_fee { goto &_list }
Subroutine _list_application_fee: called CC=1 SCAR=0.0
510  
511 2 ▶sub _refund_application_fee {
Subroutine _refund_application_fee: called CC=2 SCAR=6.9
512 2 my ( $self, $args ) = @_;
513 2 my ( $base, $id ) = delete @$args{qw(_base id)};
514 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
515 1 _clean($args);
516 1 my $path = $base . '/' . uri_escape($id) . '/refund';
517 1 return $self->_post( $path, $args );
518 }
519  
520  
521 1 ▶sub account {
Subroutine account: called CC=2 SCAR=7.0
Pod documented
522 1 my $self = shift;
523 1 ▶ unshift @_, 'retrieve' unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 1 0 1
524 1 state $actions = { map { $_ => undef } qw(retrieve) };
525 1 my ( $args, $method ) = $self->_validate( 'account', $actions, @_ );
526 1 $args->{_base} = 'account';
527 1 return $self->$method($args);
528 }
529  
530 1 ▶sub _retrieve_account {
Subroutine _retrieve_account: called CC=1 SCAR=0.0
531 1 my ( $self, $args ) = @_;
532 1 my $base = $args->{_base};
533 1 return $self->_get($base);
534 }
535  
536  
537 4 ▶sub balance {
Subroutine balance: called CC=1 SCAR=0.0
Pod documented
538 4 my $self = shift;
539 4 state $actions = { map { $_ => undef } qw(retrieve history transaction) };
540 4 my ( $args, $method ) = $self->_validate( 'balance', $actions, @_ );
541 4 $args->{_base} = 'balance';
542 4 return $self->$method($args);
543 }
544 1 ▶sub _retrieve_balance {
Subroutine _retrieve_balance: called CC=1 SCAR=0.0
545 1 my ( $self, $args ) = @_;
546 1 return $self->_get( $args->{_base} );
547 }
548  
549 2 ▶sub _transaction_balance {
Subroutine _transaction_balance: called CC=2 SCAR=6.9
550 2 my ( $self, $args ) = @_;
551 2 my ( $base, $id ) = @$args{qw(_base id)};
552 2 ▶ _invalid('No id provided.') unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
553 1 my $path = $base . '/history/' . uri_escape($id);
554 1 return $self->_get($path);
555 }
556  
557 1 ▶sub _history_balance {
Subroutine _history_balance: called CC=1 SCAR=0.0
558 1 my ( $self, $args ) = @_;
559 1 my $base = delete $args->{_base};
560 1 _clean($args);
561 1 my $path = $base . '/history';
562 1 return $self->_get( $path, $args );
563 }
564  
565  
566 3 ▶sub events {
Subroutine events: called CC=1 SCAR=0.0
Pod documented
567 3 my $self = shift;
568 3 state $actions = { map { $_ => undef } qw(retrieve list) };
569 3 my ( $args, $method ) = $self->_validate( 'event', $actions, @_ );
570 3 $args->{_base} = 'events';
571 3 return $self->$method($args);
572 }
573 2 ▶sub _retrieve_event { goto &_retrieve }
Subroutine _retrieve_event: called CC=1 SCAR=0.0
574 1 ▶sub _list_event { goto &_list }
Subroutine _list_event: called CC=1 SCAR=0.0
575  
576  
577 5 ▶sub tokens {
Subroutine tokens: called CC=1 SCAR=0.0
Pod documented
578 5 my $self = shift;
579 5 state $actions = { map { $_ => undef } qw(create retrieve bank) };
580 5 my ( $args, $method ) = $self->_validate( 'token', $actions, @_ );
581 5 $args->{_base} = 'tokens';
582 5 return $self->$method($args);
583 }
584 2 ▶sub _create_token { goto &_create }
Subroutine _create_token: called CC=1 SCAR=0.0
585 2 ▶sub _retrieve_token { goto &_retrieve }
Subroutine _retrieve_token: called CC=1 SCAR=0.0
586 1 ▶sub _bank_token { goto &_create }
Subroutine _bank_token: called CC=1 SCAR=0.0
587  
588 # Helper methods copied with modification from Net::Stripe
589  
590 34 ▶sub _get {
Subroutine _get: called CC=3 SCAR=11.0
591 34 my ( $self, $path, $args ) = @_;
592 34 ▶ $path .= '?' . _encode_params($args) if $args && %$args;
Branch: 1 branch
BranchTrueFalseTotal
if $args and %$args 8 26 34
Condition100%3/3
$args and %$args
!ll&&!rl&&r
16108
MC/DC100%2/2
$args and %$args
$args %$args
Truth table100%3/3
A and B
A= $argsB= %$args
ABresult
0X0
100
111
593 34 my $req = GET API_BASE . '/' . $path;
594 34 return $self->_make_request($req);
595 }
596  
597 # implements PHP convention for encoding "dictionaries" (why don't they accept
598 # json bodies in posts?)
599 44 ▶sub _encode_params {
Subroutine _encode_params: called CC=14 SCAR=28.0
600 44 my $args = shift;
601 44 my @components;
602 44 for my $key ( keys %$args ) {
603 67 my $ek = uri_escape($key);
604 67 my $value = $args->{$key};
605 67 ▶ if ( blessed $value
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($value) and $value->isa("Net::Stripe::Simple::Data") and exists $value->{"id"}) 16 51 67
Condition83%5/6
builtin::blessed($value) and $value->isa("Net::Stripe::Simple::Data") and exists $value->{"id"}
!ll&&!rl&&r
51016
builtin::blessed($value) and $value->isa("Net::Stripe::Simple::Data")
!ll&&!rl&&r
50116
MC/DC66%2/3
builtin::blessed($value) and $value->isa("Net::Stripe::Simple::Data") and exists $value->{"id"}
builtin::blessed($value) $value->isa("Net::Stripe::Simple::Data") exists $value->{"id"}
Truth table75%3/4
A and B and C
A= builtin::blessed($value)B= $value->isa("Net::Stripe::Simple::Data")C= exists $value->{"id"}
ABCresult
0XX0
10X0
1100
1111
606 && $value->isa('Net::Stripe::Simple::Data')
607 && exists $value->{id} )
608 {
609 16 push @components, $ek . '=' . $value->{id};
610 16 next;
611 }
612  
613 51 my $ref = ref($value);
614 51 ▶ if ($ref eq 'HASH') {
Branch: 2 branches
BranchTrueFalseTotal
if ($ref eq 'HASH') { } 21 30 51
elsif ($ref eq 'ARRAY') { } 0 30 30
615 21 for my $sk ( keys %$value ) {
616 37 my $sv = $value->{$sk};
617 next
618 37 ▶ if ref $sv; # don't think this PHP convention goes deeper
Branch: 1 branch
BranchTrueFalseTotal
if ref $sv 0 37 37
619 37 push @components,
620 $ek . '[' . uri_escape($sk) . ']=' . uri_escape_utf8($sv);
621 }
622 } elsif ($ref eq 'ARRAY') {
623 0 for my $sv (@$value) {
624 0 ▶ next if ref $sv; # again, I think we can't go deeper
Branch: 1 branch
BranchTrueFalseTotal
if ref $sv 0 0 0
625 0 push @components, $ek . '[]=' . uri_escape_utf8($sv);
626 }
627 } else {
628 30 ▶ $value = # JSON boolean stringification magic has been erased
Branch: 2 branches
BranchTrueFalseTotal
builtin::blessed($value) && $value->isa(ref &true()) ? : 1 29 30
$value ? : 0 1 1
Condition66%2/3
builtin::blessed($value) and $value->isa(ref &true())
!ll&&!rl&&r
2901
MC/DC50%1/2
builtin::blessed($value) and $value->isa(ref &true())
builtin::blessed($value) $value->isa(ref &true())
Truth table66%2/3
A and B
A= builtin::blessed($value)B= $value->isa(ref &true())
ABresult
0X0
100
111
629 blessed $value && $value->isa(ref(true())) # hack to work around inheritance issues with JSON booleans
630 ? $value
631 ? 'true'
632 : 'false'
633 : uri_escape_utf8($value);
634 30 push @components, "$ek=$value"
635 }
636 }
637 44 return join( '&', @components );
638 }
639  
640 15 ▶sub _delete {
Subroutine _delete: called CC=3 SCAR=12.0
641 15 my ( $self, $path, $args ) = @_;
642 15 ▶ $path .= '?' . _encode_params($args) if $args && %$args;
Branch: 1 branch
BranchTrueFalseTotal
if $args and %$args 0 15 15
Condition33%1/3
$args and %$args
!ll&&!rl&&r
1500
MC/DC0%0/2
$args and %$args
$args %$args
Truth table33%1/3
A and B
A= $argsB= %$args
ABresult
0X0
100
111
643 15 my $req = DELETE API_BASE . '/' . $path;
644 15 return $self->_make_request($req);
645 }
646  
647 40 ▶sub _post {
Subroutine _post: called CC=2 SCAR=6.9
648 40 my ( $self, $path, $obj ) = @_;
649  
650 40 ▶ my $req = POST API_BASE . '/' . $path,
Branch: 1 branch
BranchTrueFalseTotal
$obj ? : 36 4 40
651 ( $obj ? ( Content => _encode_params($obj) ) : () );
652 40 return $self->_make_request($req);
653 }
654  
655 89 ▶sub _make_request {
Subroutine _make_request: called CC=8 SCAR=22.3
656 89 my ( $self, $req ) = @_;
657 89 my ( $e, $resp, $ret );
658 89 state $json = do {
659 1 my $j = JSON->new;
660 1 $j->utf8(1);
661 1 $j;
662 };
663 89 eval {
664 89 $req->header( Authorization => $self->{auth} );
665 89 $req->header( Stripe_Version => $self->{version} );
666  
667 89 $resp = $self->{ua}->request($req);
668 89 ▶ if ( $resp->code == 200 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($resp->code == 200) { } 83 6 89
669 83 my $hash = $json->decode( $resp->content );
670 83 $ret = data_object($hash);
671 }
672 else {
673 6 ▶ if ( $resp->header('Content_Type') =~ m{text/html} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($resp->header('Content_Type') =~ m[text/html]) { } 0 6 6
674 0 $e = _hash_to_error(
675 code => $resp->code,
676 type => $resp->message,
677 message => $resp->message
678 );
679 }
680 else {
681 6 my $hash = $json->decode( $resp->content );
682 6 ▶ $e = _hash_to_error( $hash->{error} // $hash );
Condition33%1/3
$hash->{"error"} // $hash
l!l&&r!l&&!r
600
MC/DC0%0/2
$hash->{"error"} // $hash
$hash->{"error"} $hash
Truth table33%1/3
A // B
A= $hash->{"error"}B= $hash
ABresult
1X1
011
000
683 }
684 }
685 };
686 89 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 89 89
687 0 ▶ $e = _hash_to_error(
Branch: 1 branch
BranchTrueFalseTotal
$resp ? : 0 0 0
688 {
689 type => "Could not decode HTTP response: $@",
690 $resp
691 ? ( message => $resp->status_line . " - " . $resp->content )
692 : (),
693 }
694 );
695 }
696 89 ▶ die $e if $e;
Branch: 1 branch
BranchTrueFalseTotal
if $e 6 83 89
697 83 ▶ return $ret if $ret;
Branch: 1 branch
BranchTrueFalseTotal
if $ret 83 0 83
698 0 die _hash_to_error();
699 }
700  
701 # generates validation error when parameters required to construct the URL
702 # have not been provided
703 50 ▶sub _invalid {
Subroutine _invalid: called CC=2 SCAR=7.0
704 50 my $message = shift;
705 50 my %params = ( type => 'Required parameter missing' );
706 50 ▶ $params{message} = $message if defined $message;
Branch: 1 branch
BranchTrueFalseTotal
if defined $message 50 0 50
707 50 die _hash_to_error(%params);
708 }
709  
710  
711 12053 ▶sub data_object {
Subroutine data_object: called CC=9 SCAR=22.0
Pod documented
712 12053 my $ref = shift;
713 12053 my $rr = ref $ref;
714 12053 ▶ return unless $rr;
Branch: 1 branch
BranchTrueFalseTotal
unless $rr 9340 2713 12053
715 2713 ▶ die "forbidden class: $rr" if blessed($ref) and $rr !~ /^JSON::/;
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($ref) and not $rr =~ /^JSON::/ 0 2713 2713
Condition66%2/3
builtin::blessed($ref) and not $rr =~ /^JSON::/
!ll&&!rl&&r
19717420
MC/DC0%0/2
builtin::blessed($ref) and not $rr =~ /^JSON::/
builtin::blessed($ref) not $rr =~ /^JSON::/
Truth table66%2/3
A and not(B)
A= builtin::blessed($ref)B= not $rr =~ /^JSON::/
ABresult
0X0
100
111
716 2713 ▶ bless $ref, 'Net::Stripe::Simple::Data' if $rr eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if $rr eq "HASH" 1579 1134 2713
717  
718 2713 ▶ if ($rr eq 'HASH') {
Branch: 2 branches
BranchTrueFalseTotal
if ($rr eq 'HASH') { } 1579 1134 2713
elsif ($rr eq 'ARRAY') { } 392 742 1134
719 1579 data_object($_) for values %$ref
720 } elsif ($rr eq 'ARRAY') {
721 392 data_object($_) for @$ref
722 }
723  
724 2713 return $ref;
725 }
726  
727 60 ▶sub _hash_to_error {
Subroutine _hash_to_error: called CC=2 SCAR=6.9
728 60 ▶ my %args = ( ref $_[0] ? %{ $_[0] } : @_ );
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 7 53 60
729 60 my $o = data_object( \%args );
730 60 my $trace = Devel::StackTrace->new( ignore_package => __PACKAGE__ );
731 60 $o->{_trace} = $trace;
732 60 bless $o, 'Net::Stripe::Simple::Error';
733 }
734  
735  
736 2 ▶sub true() { JSON::true }
Subroutine true: called CC=1 SCAR=0.0
Pod documented
737 2 ▶sub false() { JSON::false }
Subroutine false: called CC=1 SCAR=0.0
Pod documented
738 1 ▶sub null() { JSON::null }
Subroutine null: called CC=1 SCAR=0.0
Pod documented
739  
740 4 1;
741  
742 __END__
« Simple/Error.pm ↑ Summary Simple/Data.pm »