| 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
Condition0%0/3
scalar @_ == 1 and builtin::blessed($_[0])
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])
| |||||||||||||||||||||||||||||||||
| 23 | { | ||||||||||||||||||||||||||||||||
| 24 | 0 | return $class->$orig(api => @_); | |||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||
| 26 | ▶ | elsif (scalar @_ == 1 and $_[0] =~ /^http/) | |||||||||||||||||||||||||||||||
|
Condition0%0/3
scalar @_ == 1 and $_[0] =~ /^http/
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/
| |||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||