| 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
MC/DC0%0/2
$attrs //= $self->fieldnames
$attrs
$self->fieldnames
Truth table33%1/3
A //= B
A= $attrsB= $self->fieldnames
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||