UPS/ReturnService.pm

filter: Statementstmt 76.3% 29 / 38 Branchbran 37.5% 3 / 8 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 6 / 8 Podpod 100% 2 / 2 totaltotal 63.6% 42 / 66 CC 7 SCAR 21.8
CC
7
Cov
65%
__ANON__
16.4
label_for_code
2.0
cache_id
2.0
CRAP 8.8
« UPS/Response/QV/Exception.pm ↑ Summary UPS/Exception.pm »
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
BranchTrueFalseTotal
if ($args->{'code'} and not $args->{'label'}) { } 0 1 1
elsif ($args->{'label'} and not $args->{'code'}) { } 1 0 1
Condition33%1/3
$args->{"code"} and not $args->{"label"}
!ll&&!rl&&r
100
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"}
ABresult
0X0
100
111
45 0 $args->{label} = $label_for_code{$args->{code}};
46 0 ▶ if (!defined $args->{label}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $args->{"label"}) 0 0 0
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"}
!ll&&!rl&&r
001
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"}
ABresult
0X0
100
111
52 1 $args->{code} = $code_for_label{$args->{label}};
53 1 ▶ if (!defined $args->{code}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $args->{"code"}) 0 1 1
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__
« UPS/Response/QV/Exception.pm ↑ Summary UPS/Exception.pm »