Base.pm

filter: Statementstmt 100% 36 / 36 Branchbran 100% 8 / 8 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 98.3% 58 / 59 CC 6 SCAR 9.4
CC
6
Cov
100%
__ANON__
5.0
import
2.0
BEGIN
1.0
CRAP 2.6
« ConnectInfo.pm ↑ Summary Subscription.pm »
1 package Net::NATS2::Base;
2  
3 5 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 32 ▶sub import {
Subroutine import: called CC=2 SCAR=6.9
8 32 my ($class, @options) = @_;
9 32 my $target = caller;
10 5 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 32 *{"${target}::has"} = \&has;
13 32 ▶ return if grep { $_ eq '-no_new' } @options;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_ eq "-no_new";} @options 10 22 32
14  
15 22 ▶ *{"${target}::new"} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
16 10 my ($class, %args) = @_;
17 10 return bless \%args, $class;
18 22 };
19 }
20  
21 290 ▶sub has {
Subroutine has: called CC=1 SCAR=0.0
Pod undocumented
22 290 my ($attribute, $default) = @_;
23 290 my $target = caller;
24 5 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 290 ▶ *{"${target}::${attribute}"} = sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
27 172 my $self = shift;
28  
29 172 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 56 116 172
30 56 $self->{$attribute} = shift;
31 56 return $self;
32 }
33  
34 116 ▶ if (!exists $self->{$attribute} && defined $default) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $self->{$attribute} and defined $default) 7 109 116
Condition100%3/3
not exists $self->{$attribute} and defined $default
!ll&&!rl&&r
81287
MC/DC100%2/2
not exists $self->{$attribute} and defined $default
not exists $self->{$attribute} defined $default
Truth table100%3/3
not(A) and B
A= not exists $self->{$attribute}B= defined $default
ABresult
0X0
100
111
35 7 ▶ $self->{$attribute} = ref $default eq 'CODE' ? $default->($self) : $default;
Branch: 1 branch
BranchTrueFalseTotal
ref $default eq 'CODE' ? : 1 6 7
36 }
37  
38 116 return $self->{$attribute};
39 290 };
40 }
41  
42 5 1;
« ConnectInfo.pm ↑ Summary Subscription.pm »