Crypto/Role/Network.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 97.3% 37 / 38 CC 3 SCAR 4.7
CC
3
Cov
100%
_trigger_network
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« Crypto/Types.pm ↑ Summary Crypto/Script/Tree/Leaf.pm »
1 package Bitcoin::Crypto::Role::Network;
2 68 $Bitcoin::Crypto::Role::Network::VERSION = '4.006';
3 68 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 68 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 68 ▶use Mooish::Base -standard, -role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 68 ▶use Bitcoin::Crypto::Network;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 68 ▶use Bitcoin::Crypto::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 has param 'network' => (
12 coerce => (InstanceOf ['Bitcoin::Crypto::Network'])
13 ->plus_coercions(Str, q{Bitcoin::Crypto::Network->get($_)}),
14 4391 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
15 4391 return Bitcoin::Crypto::Network->get;
16 },
17 68 writer => -hidden,
18 trigger => -hidden,
19 );
20  
21 sub _trigger_network
22 864 ▶{
Subroutine _trigger_network: called CC=3 SCAR=11.0
23 864 my ($self) = @_;
24  
25 864 ▶ if (Bitcoin::Crypto::Network->single_network) {
Branch: 1 branch
BranchTrueFalseTotal
if ("Bitcoin::Crypto::Network"->single_network) 3 861 864
26 3 my $default = Bitcoin::Crypto::Network->get;
27 3 ▶ Bitcoin::Crypto::Exception::NetworkCheck->raise(
Branch: 1 branch
BranchTrueFalseTotal
if $default->id ne $self->network->id 2 1 3
28 sprintf 'invalid network %s, running in single-network mode with %s', $self->network->id, $default->id
29 ) if $default->id ne $self->network->id;
30 }
31 }
32  
33 sub set_network
34 128 ▶{
Subroutine set_network: called CC=1 SCAR=0.0
Pod undocumented
35 128 my ($self, $network) = @_;
36 128 $self->_set_network($network);
37  
38 # chainable - undocumented behavior, but kept for backcompat
39 127 return $self;
40 }
41  
42 68 1;
43  
« Crypto/Types.pm ↑ Summary Crypto/Script/Tree/Leaf.pm »