Bitcoin/Role/HasAPI.pm

filter: Statementstmt 63.6% 14 / 22 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 4 / 6 Podpod n/a totaltotal 42.8% 18 / 42 CC 5 SCAR 27.5
CC
5
Cov
44%
__ANON__
30.0
__ANON__
2.0
BEGIN
1.0
CRAP 15.6
« Bitcoin/API.pm ↑ Summary Bitcoin/Wallet.pm »
1 package Finance::Bitcoin::Role::HasAPI;
2  
3 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 $Finance::Bitcoin::Role::HasAPI::AUTHORITY = 'cpan:TOBYINK';
5 1 $Finance::Bitcoin::Role::HasAPI::VERSION = '0.902';
6 }
7  
8 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Finance::Bitcoin::API;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 has api => (
13 is => 'rw',
14 0 ▶ default => sub { "Finance::Bitcoin::API"->new },
Subroutine __ANON__: not called CC=1 SCAR=6.9
15 1 );
16  
17 around BUILDARGS => sub
18 0 ▶{
Subroutine __ANON__: not called CC=5 SCAR=34.0
19 0 my $orig = shift;
20 0 my $class = shift;
21
22 0 ▶ if (scalar @_ == 1 and blessed $_[0])
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @_ == 1 and builtin::blessed($_[0])) { } 0 0 0
elsif (scalar @_ == 1 and $_[0] =~ /^http/) { } 0 0 0
Condition0%0/3
scalar @_ == 1 and builtin::blessed($_[0])
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @_ == 1 and builtin::blessed($_[0])
scalar @_ == 1 builtin::blessed($_[0])
Truth table0%0/3
A and B
A= scalar @_ == 1B= builtin::blessed($_[0])
ABresult
0X0
100
111
23 {
24 0 return $class->$orig(api => @_);
25 }
26 ▶ elsif (scalar @_ == 1 and $_[0] =~ /^http/)
Condition0%0/3
scalar @_ == 1 and $_[0] =~ /^http/
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @_ == 1 and $_[0] =~ /^http/
scalar @_ == 1 $_[0] =~ /^http/
Truth table0%0/3
A and B
A= scalar @_ == 1B= $_[0] =~ /^http/
ABresult
0X0
100
111
27 {
28 0 my $api = "Finance::Bitcoin::API"->new(endpoint => "$_[0]");
29 0 return $class->$orig(api => $api);
30 }
31
32 0 return $class->$orig(@_);
33 1 };
34  
35 1 1;
36  
37 __END__
« Bitcoin/API.pm ↑ Summary Bitcoin/Wallet.pm »