| 1 | |||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | package Class::Delegation::Simple; | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | $VERSION = '0.02'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | sub import | ||||||||||||||||||||
| 12 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
import: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 13 | 2 | my ($class, @args) = @_; | |||||||||||||||||||
| 14 | 2 | my ($caller) = caller; | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | # Install the handler(s): | ||||||||||||||||||||
| 17 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 1 | ▶ | no warnings 'redefine'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 2 | ▶ | while( my $set = shift(@args) ) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 20 | { | ||||||||||||||||||||
| 21 | 2 | my $to = $set->{to}; | |||||||||||||||||||
| 22 | 2 | my $method = $set->{send}; | |||||||||||||||||||
| 23 | 2 | ▶ | my $as = $set->{as} || $method; | ||||||||||||||||||
|
Condition66%2/3
$set->{'as'} || $method
MC/DC0%0/2
$set->{'as'} || $method
$set->{'as'}
$method
Truth table66%2/3
A || B
A= $set->{'as'}B= $method
| |||||||||||||||||||||
| 24 | 2 | ▶ | *{"$caller\::$method"} = sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||
| 25 | 1004 | my $s = shift; | |||||||||||||||||||
| 26 | 1004 | ▶ | if( ref($to) ) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | { | ||||||||||||||||||||
| 28 | 2 | my @res; | |||||||||||||||||||
| 29 | 2 | push @res, $s->{$_}->$as( @_ ) foreach @$to; | |||||||||||||||||||
| 30 | 2 | ▶ | return @res if defined(wantarray); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | else | ||||||||||||||||||||
| 33 | { | ||||||||||||||||||||
| 34 | 1002 | $s->{$to}->$as( @_ ); | |||||||||||||||||||
| 35 | }# end if() | ||||||||||||||||||||
| 36 | 2 | }; | |||||||||||||||||||
| 37 | }# end while() | ||||||||||||||||||||
| 38 | }# end import() | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 1 | 1;# return true: | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||