| 1 | package WebService::Simple; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use base qw(LWP::UserAgent Class::Data::ConfigHash); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use Class::Inspector; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use Data::Dumper (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 11 | ▶ | use Digest::MD5 (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 11 | ▶ | use URI::Escape; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use URI::QueryParam; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 11 | ▶ | use HTTP::Message; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 11 | ▶ | use Hash::MultiValue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 11 | ▶ | use WebService::Simple::Response; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 11 | ▶ | use UNIVERSAL::require; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 11 | our $VERSION = '0.26'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 11 | __PACKAGE__->config( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | base_url => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | response_parser => { module => "XML::Simple" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 15 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=25 SCAR=39.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 15 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 15 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | my $base_url = delete $args{base_url} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | || $class->config->{base_url} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 15 | ▶ | || Carp::croak("base_url is required"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
delete $args{'base_url'} || $class->config->{'base_url'} || Carp::croak('base_url is required')
delete $args{"base_url"} or $class->config->{"base_url"}
MC/DC0%0/2
delete $args{'base_url'} || $class->config->{'base_url'} || Carp::croak('base_url is required')
delete $args{"base_url"}
$class->config->{"base_url"}
Truth table33%1/3
A or B
A= delete $args{"base_url"}B= $class->config->{"base_url"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 15 | $base_url = URI->new($base_url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 15 | ▶ | my $basic_params = delete $args{params} || delete $args{param} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%5/5
delete $args{'params'} || delete $args{'param'} || {}
delete $args{"params"} or delete $args{"param"}
MC/DC100%2/2
delete $args{'params'} || delete $args{'param'} || {}
delete $args{"params"}
delete $args{"param"}
Truth table100%3/3
A or B
A= delete $args{"params"}B= delete $args{"param"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 15 | ▶ | my $debug = delete $args{debug} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $args{'debug'} || 0
MC/DC0%0/1
delete $args{'debug'} || 0
delete $args{'debug'}
Truth table50%1/2
A
A= delete $args{'debug'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | my $response_parser = delete $args{response_parser} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 15 | ▶ | || $class->config->{response_parser}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
delete $args{'response_parser'} || $class->config->{'response_parser'}
MC/DC0%0/2
delete $args{'response_parser'} || $class->config->{'response_parser'}
delete $args{'response_parser'}
$class->config->{'response_parser'}
Truth table66%2/3
A || B
A= delete $args{'response_parser'}B= $class->config->{'response_parser'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 15 | ▶ | if ( !$response_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$response_parser and eval {
do {
$response_parser->isa("WebService::Simple::Parser")
}
}
MC/DC0%0/2
$response_parser and eval {
do {
$response_parser->isa("WebService::Simple::Parser")
}
}
$response_parser
eval {
do {
$response_parser->isa("WebService::Simple::Parser")
}
}
Truth table33%1/3
A and B
A= $response_parserB= eval {
do {
$response_parser->isa("WebService::Simple::Parser")
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 15 | || !eval { $response_parser->isa('WebService::Simple::Parser') } ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 15 | ▶ | my $config = $response_parser || $class->config->{response_parser}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$response_parser || $class->config->{'response_parser'}
MC/DC0%0/2
$response_parser || $class->config->{'response_parser'}
$response_parser
$class->config->{'response_parser'}
Truth table33%1/3
A || B
A= $response_parserB= $class->config->{'response_parser'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 15 | ▶ | if ( !ref $config ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | $config = { module => $config }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 15 | my $module = $config->{module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 15 | ▶ | if ( $module !~ s/^\+// ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 15 | $module = __PACKAGE__ . "::Parser::$module"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 15 | ▶ | if ( !Class::Inspector->loaded($module) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 10 | ▶ | $module->require or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 15 | ▶ | $response_parser = $module->new( %{ $config->{args} || {} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$config->{'args'} || {}
MC/DC0%0/1
$config->{'args'} || {}
$config->{'args'}
Truth table50%1/2
A
A= $config->{'args'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 15 | my $cache = delete $args{cache}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 15 | ▶ | if ( !$cache || ref $cache eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $cache or ref $cache eq "HASH"
MC/DC0%0/2
not $cache or ref $cache eq "HASH"
not $cache
ref $cache eq "HASH"
Truth table33%1/3
not(A) or B
A= not $cacheB= ref $cache eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 15 | ▶ | my $config = ref $cache eq 'HASH' ? $cache : $class->config->{cache}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 15 | ▶ | if ($config) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ( !ref $config ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $config = { module => $config }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $module = $config->{module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if ( !Class::Inspector->loaded($module) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | $module->require or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | $cache = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | $module->new( $config->{hashref_args} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ? $config->{args} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | : %{ $config->{args} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 15 | my $self = $class->SUPER::new(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 15 | $self->{base_url} = $base_url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 15 | $self->{basic_params} = $basic_params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 15 | $self->{response_parser} = $response_parser; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 15 | $self->{cache} = $cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 15 | $self->{compression} = delete $args{compression}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 15 | $self->{content_type} = delete $args{content_type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 15 | $self->{croak} = delete $args{croak}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 15 | $self->{debug} = $debug; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 15 | ▶ | if($self->{content_type} && $self->{content_type} eq 'application/json'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"content_type"} and $self->{"content_type"} eq "application/json"
MC/DC50%1/2
$self->{"content_type"} and $self->{"content_type"} eq "application/json"
$self->{"content_type"}
$self->{"content_type"} eq "application/json"
Truth table66%2/3
A and B
A= $self->{"content_type"}B= $self->{"content_type"} eq "application/json"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | $self->__init_request_parser_json(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | $self->{request_parser} = sub { return \$_[0] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 15 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 15 | ▶ | sub _agent { "libwww-perl/$LWP::VERSION+". __PACKAGE__ .'/'.$VERSION } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_agent: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 37 | ▶ | sub base_url { $_[0]->{base_url} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
base_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 37 | ▶ | sub basic_params { $_[0]->{basic_params} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
basic_params: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 43 | ▶ | sub response_parser { $_[0]->{response_parser} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
response_parser: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub request_parser { $_[0]->{request_parser} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_parser: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 34 | ▶ | sub cache { $_[0]->{cache} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cache: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 17 | ▶ | sub __cache_get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__cache_get: called CC=2 SCAR=8.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 17 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 17 | my $cache = $self->cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 17 | ▶ | return unless $cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $key = $self->__cache_key(shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | return $cache->get( $key, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 17 | ▶ | sub __cache_set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__cache_set: called CC=2 SCAR=8.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 17 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 17 | my $cache = $self->cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 17 | ▶ | return unless $cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $key = $self->__cache_key(shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | return $cache->set( $key, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | sub __cache_remove { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__cache_remove: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my $cache = $self->cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | return unless $cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $key = $self->__cache_key(shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | return $cache->remove( $key, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub __cache_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__cache_key: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | local $Data::Dumper::Indent = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | local $Data::Dumper::Terse = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | local $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | return Digest::MD5::md5_hex( Data::Dumper::Dumper( $_[0] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 2 | ▶ | sub __init_request_parser_json { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__init_request_parser_json: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 2 | require WebService::Simple::Parser::JSON; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | my $json_parser = WebService::Simple::Parser::JSON->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 2 | ▶ | $self->{request_parser_json} = sub { $json_parser->parse_request(@_); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 38 | ▶ | sub request_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_url: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 38 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 38 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 38 | ▶ | my $uri = ref($args{url}) =~ m/^URI/ ? $args{url}->clone() : URI->new($args{url}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 38 | ▶ | if ( my $extra_path = $args{extra_path} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 13 | $extra_path =~ s!^/!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 13 | $uri->path( $uri->path . $extra_path ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 38 | ▶ | if($args{params}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 36 | ▶ | if(ref $args{params} eq 'Hash::MultiValue') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 35 | for my $key (sort $args{params}->keys) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 43 | $uri->query_param_append($key, $args{params}->get($key)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | $uri->query_form(%{$args{params}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 38 | return $uri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 17 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=11 SCAR=28.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 17 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 17 | my ($url, $extra) = ("", {}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 17 | ▶ | if ( ref $_[0] eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 8 | $extra = shift @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 9 | $url = shift @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 9 | ▶ | if ( ref $_[0] eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 4 | $extra = shift @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | my $uri = $self->request_url( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | url => $self->base_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | extra_path => $url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 17 | params => Hash::MultiValue->new(%{$self->basic_params}, %$extra), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 17 | ▶ | warn "Request URL is $uri\n" if $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 17 | my @headers = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 17 | ▶ | unless(defined($self->{compression}) && !$self->{compression}){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $self->{"compression"} and not $self->{"compression"}
MC/DC0%0/2
defined $self->{"compression"} and not $self->{"compression"}
defined $self->{"compression"}
not $self->{"compression"}
Truth table33%1/3
A and not(B)
A= defined $self->{"compression"}B= not $self->{"compression"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 17 | my $can_accept = HTTP::Message::decodable(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 17 | push @headers, ('Accept-Encoding' => $can_accept) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 17 | my $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 17 | $response = $self->__cache_get( [ $uri, @headers ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 17 | ▶ | if ($response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if ($response->isa('WebService::Simple::Response')) { # backward compatibility | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | return WebService::Simple::Response->new_from_response( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | response => $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | parser => $self->response_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 17 | $response = $self->SUPER::get( $uri, @headers ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 17 | ▶ | if ( $response->is_success ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 17 | $self->__cache_set( [ $uri, @headers ], $response ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 17 | $response = WebService::Simple::Response->new_from_response( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | response => $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | parser => $self->response_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | Carp::croak("request to $uri failed") unless defined($self->{croak}) && !$self->{croak}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"croak"} and not $self->{"croak"}
MC/DC0%0/2
defined $self->{"croak"} and not $self->{"croak"}
defined $self->{"croak"}
not $self->{"croak"}
Truth table0%0/3
A and not(B)
A= defined $self->{"croak"}B= not $self->{"croak"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 17 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 20 | ▶ | sub post { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post: called CC=15 SCAR=28.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 20 | my ( $url, $extra ) = ( '', {} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 20 | ▶ | if ( ref $_[0] eq 'HASH' ) { # post(\%arg [, @header ]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 10 | $extra = shift @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | elsif ( ref $_[1] eq 'HASH' ) { # post($url, \%arg [, @header ]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 5 | $url = shift @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 5 | $extra = shift @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | elsif ( @_ % 2 ) { # post($url [, @header ]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 2 | $url = shift @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 20 | my @headers = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 20 | ▶ | unless(defined($self->{compression}) && !$self->{compression}){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $self->{"compression"} and not $self->{"compression"}
MC/DC0%0/2
defined $self->{"compression"} and not $self->{"compression"}
defined $self->{"compression"}
not $self->{"compression"}
Truth table33%1/3
A and not(B)
A= defined $self->{"compression"}B= not $self->{"compression"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 20 | my $can_accept = HTTP::Message::decodable(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 20 | push @headers, ('Accept-Encoding' => $can_accept) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 20 | my %headers = @headers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # Content-Type tells us where "extra params" go: form-urlencoded -> $uri / json/xml -> $content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 20 | my ($uri,$response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 20 | ▶ | if( ($self->{content_type} && $self->{content_type} eq 'application/json') || ($headers{'Content-Type'} && $headers{'Content-Type'} eq 'application/json') ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$self->{"content_type"} and $self->{"content_type"} eq "application/json" or $headers{"Content-Type"} and $headers{"Content-Type"} eq "application/json"
$self->{"content_type"} and $self->{"content_type"} eq "application/json"
$headers{"Content-Type"} and $headers{"Content-Type"} eq "application/json"
MC/DC50%2/4
$self->{"content_type"} and $self->{"content_type"} eq "application/json" or $headers{"Content-Type"} and $headers{"Content-Type"} eq "application/json"
$self->{"content_type"}
$self->{"content_type"} eq "application/json"
$headers{"Content-Type"}
$headers{"Content-Type"} eq "application/json"
Truth table42%3/7
A and B or C and D
A= $self->{"content_type"}B= $self->{"content_type"} eq "application/json"C= $headers{"Content-Type"}D= $headers{"Content-Type"} eq "application/json"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 2 | ▶ | $self->__init_request_parser_json() unless $self->{request_parser_json}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | $uri = $self->request_url( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | url => $self->base_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | extra_path => $url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | # params => Hash::MultiValue->new(%{$self->basic_params}, %$extra), # this'll go to content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # $uri->query_form(undef); # we'll leave all params on the url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 2 | my $req = HTTP::Request->new(POST => $uri, \@headers); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 2 | $req->content_type('application/json'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 2 | $req->content($self->{request_parser_json}->({ %{$self->basic_params}, %$extra })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | $response = $self->SUPER::request($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | $uri = $self->request_url( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | url => $self->base_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | extra_path => $url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 18 | params => Hash::MultiValue->new(%{$self->basic_params}, %$extra), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 18 | my $content = $uri->query_form_hash(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 18 | $uri->query_form(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 18 | ▶ | push(@headers, 'Content-Type' => $self->{content_type}) if $self->{content_type}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 18 | $response = $self->SUPER::post( $uri, $content, @headers ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 20 | ▶ | if ( $response->is_success ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 20 | $response = WebService::Simple::Response->new_from_response( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | response => $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | parser => $self->response_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | Carp::croak("request to $uri failed") unless defined($self->{croak}) && !$self->{croak}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"croak"} and not $self->{"croak"}
MC/DC0%0/2
defined $self->{"croak"} and not $self->{"croak"}
defined $self->{"croak"}
not $self->{"croak"}
Truth table0%0/3
A and not(B)
A= defined $self->{"croak"}B= not $self->{"croak"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 20 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||