| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 30 | 56 | $self->{$attribute} = shift; | |||||||||||||||||||||||||||
| 31 | 56 | return $self; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 116 | ▶ | if (!exists $self->{$attribute} && defined $default) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not exists $self->{$attribute} and defined $default
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
| |||||||||||||||||||||||||||||
| 35 | 7 | ▶ | $self->{$attribute} = ref $default eq 'CODE' ? $default->($self) : $default; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 116 | return $self->{$attribute}; | |||||||||||||||||||||||||||
| 39 | 290 | }; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 5 | 1; | |||||||||||||||||||||||||||