| 1 | package Net::Async::Webservice::UPS::ReturnService; | ||||||||||||||||||||||||||||||||
| 2 | 1 | $Net::Async::Webservice::UPS::ReturnService::VERSION = '1.1.4'; | |||||||||||||||||||||||||||||||
| 3 | { | ||||||||||||||||||||||||||||||||
| 4 | 1 | $Net::Async::Webservice::UPS::ReturnService::DIST = 'Net-Async-Webservice-UPS'; | |||||||||||||||||||||||||||||||
| 5 | } | ||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Types::Standard qw(Str); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Net::Async::Webservice::UPS::Types ':types'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | # ABSTRACT: shipment return service from UPS | ||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 1 | has code => ( | |||||||||||||||||||||||||||||||
| 16 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 17 | isa => ReturnServiceCode, | ||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | 1 | has label => ( | |||||||||||||||||||||||||||||||
| 22 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 23 | isa => ReturnServiceLabel, | ||||||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | 1 | my %code_for_label = ( | |||||||||||||||||||||||||||||||
| 27 | PNM => '2', | ||||||||||||||||||||||||||||||||
| 28 | RS1 => '3', | ||||||||||||||||||||||||||||||||
| 29 | RS3 => '5', | ||||||||||||||||||||||||||||||||
| 30 | ERL => '8', | ||||||||||||||||||||||||||||||||
| 31 | PRL => '9', | ||||||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||||||
| 33 | 1 | my %label_for_code = reverse %code_for_label; | |||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub label_for_code { | ||||||||||||||||||||||||||||||
|
Subroutine
label_for_code: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 37 | 0 | my ($code) = @_; | |||||||||||||||||||||||||||||||
| 38 | 0 | return $label_for_code{$code}; | |||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | 1 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=28.0
| |||||||||||||||||||||||||||||||||
| 42 | 1 | my ($orig,$class,@etc) = @_; | |||||||||||||||||||||||||||||||
| 43 | 1 | my $args = $class->$orig(@etc); | |||||||||||||||||||||||||||||||
| 44 | 1 | ▶ | if ($args->{code} and not $args->{label}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$args->{"code"} and not $args->{"label"}
MC/DC0%0/2
$args->{"code"} and not $args->{"label"}
$args->{"code"}
not $args->{"label"}
Truth table33%1/3
A and not(B)
A= $args->{"code"}B= not $args->{"label"}
| |||||||||||||||||||||||||||||||||
| 45 | 0 | $args->{label} = $label_for_code{$args->{code}}; | |||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if (!defined $args->{label}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 47 | 0 | require Carp; | |||||||||||||||||||||||||||||||
| 48 | 0 | Carp::croak "Bad return service code $args->{code}"; | |||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||
| 51 | ▶ | elsif ($args->{label} and not $args->{code}) { | |||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{"label"} and not $args->{"code"}
MC/DC0%0/2
$args->{"label"} and not $args->{"code"}
$args->{"label"}
not $args->{"code"}
Truth table33%1/3
A and not(B)
A= $args->{"label"}B= not $args->{"code"}
| |||||||||||||||||||||||||||||||||
| 52 | 1 | $args->{code} = $code_for_label{$args->{label}}; | |||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | if (!defined $args->{code}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 54 | 0 | require Carp; | |||||||||||||||||||||||||||||||
| 55 | 0 | Carp::croak "Bad return service label $args->{label}"; | |||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||
| 58 | 1 | return $args; | |||||||||||||||||||||||||||||||
| 59 | 1 | }; | |||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub cache_id { return $_[0]->code } | ||||||||||||||||||||||||||||||
|
Subroutine
cache_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||
| 64 | 1 | 1; | |||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | __END__ | ||||||||||||||||||||||||||||||||