| 1 | package Net::Async::Webservice::Common::WithUserAgent; | ||||||||||||||||||||||||||||
| 2 | 1 | $Net::Async::Webservice::Common::WithUserAgent::VERSION = '1.0.2'; | |||||||||||||||||||||||||||
| 3 | { | ||||||||||||||||||||||||||||
| 4 | 1 | $Net::Async::Webservice::Common::WithUserAgent::DIST = 'Net-Async-Webservice-Common'; | |||||||||||||||||||||||||||
| 5 | } | ||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Net::Async::Webservice::Common::Types qw(AsyncUserAgent); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # ABSTRACT: user_agent attribute, sync or async | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | has user_agent => ( | |||||||||||||||||||||||||||
| 15 | is => 'ro', | ||||||||||||||||||||||||||||
| 16 | isa => AsyncUserAgent, | ||||||||||||||||||||||||||||
| 17 | required => 1, | ||||||||||||||||||||||||||||
| 18 | coerce => AsyncUserAgent->coercion, | ||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 3 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 22 | 3 | my ($orig,$class,@args) = @_; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 3 | my $ret = $class->$orig(@args); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 3 | ▶ | if (ref $ret->{loop} && !$ret->{user_agent}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $ret->{"loop"} and not $ret->{"user_agent"}
MC/DC50%1/2
ref $ret->{"loop"} and not $ret->{"user_agent"}
ref $ret->{"loop"}
not $ret->{"user_agent"}
Truth table66%2/3
A and not(B)
A= ref $ret->{"loop"}B= not $ret->{"user_agent"}
| |||||||||||||||||||||||||||||
| 27 | 1 | require Net::Async::HTTP; | |||||||||||||||||||||||||||
| 28 | 1 | $ret->{user_agent} = Net::Async::HTTP->new(); | |||||||||||||||||||||||||||
| 29 | 1 | $ret->{loop}->add($ret->{user_agent}); | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 3 | return $ret; | |||||||||||||||||||||||||||
| 33 | 1 | }; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | 1; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||