Branch Coverage

blib/lib/WWW/Pastebin/PastebinCom/API.pm
Criterion Covered Total %
branch 38 106 35.8


line true false branch
23 1 0 defined $obj->error ? :
28 0 1 if @_ & 1
34 0 1 unless ($args{'timeout'})
37 1 0 unless ($args{'ua'})
57 0 1 unless my $api_key = $self->_get_api_key
60 0 1 unless my $user_key = $self->_get_user_key
74 1 0 if ($response->is_success or $response->is_redirect) { }
75 0 1 if $response->content =~ /^Bad API request/
89 0 0 if $limit < 1
90 0 0 if $limit > 1000
94 0 0 unless my $api_key = $self->_get_api_key
97 0 0 unless my $user_key = $self->_get_user_key
112 0 0 if ($response->is_success or $response->is_redirect) { }
113 0 0 if $response->content =~ /^Bad API request/
116 0 0 if $response->content =~ /^No pastes found/
132 0 1 unless my $api_key = $self->_get_api_key
143 1 0 if ($response->is_success or $response->is_redirect) { }
144 0 1 if $response->content =~ /^Bad API request/
161 0 0 unless defined $paste_key and length $paste_key
166 0 0 unless my $api_key = $self->_get_api_key
169 0 0 unless my $user_key = $self->_get_user_key
185 0 0 if ($response->is_success or $response->is_redirect) { }
186 0 0 if $response->content =~ /^Bad API request/
207 0 2 unless defined $paste_key and length $paste_key
210 0 2 if (defined $login and defined $pass)
228 2 0 if ($response->is_success or $response->is_redirect) { }
229 0 2 unless defined $response->content and length $response->content
233 0 2 if $response->content eq 'Error, this is a private paste. If this is your private paste, please login to Pastebin first.'
241 0 0 if ($response->status_line eq '404 Not Found') { }
258 0 1 unless defined $paste_text and length $paste_text
264 0 1 unless my(@args) = $self->_prepare_optional_api_options(\%args)
267 0 1 unless my $api_key = $self->_get_api_key
282 1 0 if ($response->is_success or $response->is_redirect) { }
283 1 0 if $response->content =~ /^Bad API request|^Post limit, maximum pastes/
300 0 1 unless my $api_key = $self->_get_api_key
312 1 0 if ($response->is_success or $response->is_redirect) { }
313 0 1 if $response->content =~ /^Bad API request/
331 0 1 if ($user{'private'} == 2) { }
0 1 elsif ($user{'private'} == 1) { }
341 0 1 wantarray ? :
353 0 18 if ($private_flag == 2) { }
0 18 elsif ($private_flag == 1) { }
359 0 1 wantarray ? :
385 0 1 if defined $$args{'title'}
388 1 0 if (defined $$args{'format'})
389 0 1 unless $self->_is_valid_format($$args{'format'})
397 0 1 if ($$args{'owned'} and not $$args{'private'})
398 0 0 unless defined($$args{'user_key'} || $self->user_key)
409 1 0 if ($$args{'private'}) { }
0 0 elsif ($$args{'unlisted'}) { }
410 0 1 unless defined($$args{'user_key'} || $self->user_key)
432 1 0 if ($$args{'expiry'})
433 0 1 unless my $expiry = $self->_translate_expiry($$args{'expiry'})