Common/WithUserAgent.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 94.4% 34 / 36 CC 3 SCAR 6.2
CC
3
Cov
97%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« Common.pm ↑ Summary Common/WithConfigFile.pm »
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
BranchTrueFalseTotal
if (ref $ret->{"loop"} and not $ret->{"user_agent"}) 1 2 3
Condition66%2/3
ref $ret->{"loop"} and not $ret->{"user_agent"}
!ll&&!rl&&r
201
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"}
ABresult
0X0
100
111
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__
« Common.pm ↑ Summary Common/WithConfigFile.pm »