| 1 | 40 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 2 | 40 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | package Test::Deep::MM 1.205; | ||||||||||||
| 5 | |||||||||||||
| 6 | sub import | ||||||||||||
| 7 | 40 | ▶ | { | ||||||||||
|
Subroutine
import: called CC=3 SCAR=11.0
| |||||||||||||
| 8 | 40 | my $self = shift; | |||||||||||
| 9 | |||||||||||||
| 10 | 40 | my ($pkg) = caller(); | |||||||||||
| 11 | 40 | my $mpkg = $pkg."::Methods"; | |||||||||||
| 12 | 40 | foreach my $attr (@_) | |||||||||||
| 13 | { | ||||||||||||
| 14 | 160 | ▶ | if ($attr =~ /^[a-z]/) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 15 | { | ||||||||||||
| 16 | 40 | ▶ | no strict 'refs'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | 80 | *{$mpkg."::$attr"} = \&{$attr}; | |||||||||||
| 18 | } | ||||||||||||
| 19 | else | ||||||||||||
| 20 | { | ||||||||||||
| 21 | 80 | my $get_name = $mpkg."::get$attr"; | |||||||||||
| 22 | 80 | my $set_name = $mpkg."::set$attr"; | |||||||||||
| 23 | 4987 | ▶ | my $get_sub = sub { | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 24 | 4987 | return $_[0]->{$attr}; | |||||||||||
| 25 | 80 | }; | |||||||||||
| 26 | 1214 | ▶ | my $set_sub = sub { | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | 1214 | return $_[0]->{$attr} = $_[1]; | |||||||||||
| 28 | 80 | }; | |||||||||||
| 29 | |||||||||||||
| 30 | { | ||||||||||||
| 31 | 40 | ▶ | no strict 'refs'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 32 | 80 | *$get_name = $get_sub; | |||||||||||
| 33 | 80 | *$set_name = $set_sub; | |||||||||||
| 34 | 80 | push(@{$pkg."::ISA"}, $mpkg); | |||||||||||
| 35 | } | ||||||||||||
| 36 | } | ||||||||||||
| 37 | } | ||||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | sub new | ||||||||||||
| 41 | 874 | ▶ | { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 42 | 874 | my $pkg = shift; | |||||||||||
| 43 | |||||||||||||
| 44 | 874 | my $self = bless {}, $pkg; | |||||||||||
| 45 | |||||||||||||
| 46 | 874 | $self->init(@_); | |||||||||||
| 47 | |||||||||||||
| 48 | 874 | return $self; | |||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | sub init | ||||||||||||
| 52 | 874 | ▶ | { | ||||||||||
|
Subroutine
init: called CC=3 SCAR=17.3
Pod
undocumented
| |||||||||||||
| 53 | 874 | my $self = shift; | |||||||||||
| 54 | |||||||||||||
| 55 | 874 | ▶ | while (@_) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 56 | { | ||||||||||||
| 57 | 0 | ▶ | my $name = shift || confess("No name"); | ||||||||||
|
Condition0%0/2
shift() || confess('No name')
MC/DC0%0/1
shift() || confess('No name')
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 58 | |||||||||||||
| 59 | 0 | my $method = "set$name"; | |||||||||||
| 60 | 0 | $self->$method(shift); | |||||||||||
| 61 | } | ||||||||||||
| 62 | } | ||||||||||||
| 63 | |||||||||||||
| 64 | 40 | 1; | |||||||||||
| 65 | |||||||||||||
| 66 | __END__ | ||||||||||||