| 1 | 8 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 0 | ▶ | BEGIN { if ($] < 5.010000) { require UNIVERSAL::DOES } }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=9.2
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | package MooX::Traits; | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 8 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||
| 10 | 8 | our $VERSION = '0.005'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use Role::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub _trait_namespace | ||||||||||||||||||||||||||||
| 15 | 17 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_trait_namespace: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 17 | (); | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | sub with_traits | ||||||||||||||||||||||||||||
| 20 | 34 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
with_traits: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | 34 | my $class = shift; | |||||||||||||||||||||||||||
| 22 | 34 | ▶ | return $class unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 26 | require MooX::Traits::Util; | |||||||||||||||||||||||||||
| 25 | 26 | MooX::Traits::Util::new_class_with_traits($class, @_); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | sub new_with_traits | ||||||||||||||||||||||||||||
| 29 | 23 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new_with_traits: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 30 | 23 | my $class = shift; | |||||||||||||||||||||||||||
| 31 | 23 | my (%args, $pass_as_ref); | |||||||||||||||||||||||||||
| 32 | 23 | ▶ | if (@_==1 and ref($_[0]) eq 'HASH') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC50%1/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||
| 34 | 1 | %args = %{$_[0]}; | |||||||||||||||||||||||||||
| 35 | 1 | $pass_as_ref = !!1; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | else | ||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||
| 39 | 22 | %args = @_; | |||||||||||||||||||||||||||
| 40 | 22 | $pass_as_ref = !!0; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 23 | ▶ | my $traits_arr = delete($args{traits}) || []; | ||||||||||||||||||||||||||
|
Condition100%2/2
delete $args{'traits'} || []
MC/DC100%1/1
delete $args{'traits'} || []
delete $args{'traits'}
Truth table100%2/2
A
A= delete $args{'traits'}
| |||||||||||||||||||||||||||||
| 44 | 23 | ▶ | my @traits = ref($traits_arr) ? @$traits_arr : $traits_arr; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 23 | ▶ | $class->with_traits(@traits)->new( $pass_as_ref ? \%args : %args ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 8 | 1; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | __END__ | ||||||||||||||||||||||||||||