Easypost/PostOnBuild.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 84.0% 21 / 25 CC 2 SCAR 3.5
CC
2
Cov
88%
serialize
2.1
BEGIN
1.0
BUILD
1.0
CRAP 1.4
« Easypost/Label.pm ↑ Summary Easypost/Parcel.pm »
1 package Net::Easypost::PostOnBuild;
2 6 $Net::Easypost::PostOnBuild::VERSION = '0.23';
3 6 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 39 ▶sub BUILD {}
Subroutine BUILD: called CC=1 SCAR=0.0
Pod documented
6 45 ▶after 'BUILD' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
7 45 my $self = shift;
8  
9 45 my $resp = $self->requester->post(
10 $self->operation,
11 $self->serialize,
12 );
13 45 $self->_set_id( $resp->{id} );
14 6 };
15  
16 7 ▶sub serialize {
Subroutine serialize: called CC=2 SCAR=7.2
Pod documented
17 7 my ($self, $attrs) = @_;
18 7 ▶ $attrs //= $self->fieldnames;
Condition33%1/3
$attrs //= $self->fieldnames
l!l&&r!l&&!r
070
MC/DC0%0/2
$attrs //= $self->fieldnames
$attrs $self->fieldnames
Truth table33%1/3
A //= B
A= $attrsB= $self->fieldnames
ABresult
1X1
011
000
19  
20 # want a hashref of e.g., role[field1] => foo from all defined attributes
21 return {
22 25 map { $self->role . "[$_]" => $self->$_ }
23 7 grep { defined $self->$_ } @$attrs
24 };
25 }
26  
27 6 1;
28  
29 __END__
« Easypost/Label.pm ↑ Summary Easypost/Parcel.pm »