| 1 | package Class::Delegation; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | our $VERSION = '1.009001'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 77 | ▶ | sub ::DEBUG { 0 }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DEBUG: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | my %mappings; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | my $caller = caller(); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | while (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 19 | push @{$mappings{$caller}}, Class::Delegation::->_new(\@_); | |||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | INIT { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
INIT: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | foreach my $class (keys %mappings) { | |||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | _install_delegation_for($class); | |||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | sub _install_delegation_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_install_delegation_for: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 4 | ▶ | use vars '$AUTOLOAD'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | my $symbol = "${class}::AUTOLOAD"; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | print STDERR "Installing $symbol\n" if ::DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | my $real_AUTOLOAD = *{$symbol}{CODE} | |||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | || sub {croak "Could not delegate $AUTOLOAD"}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.6
Condition66%2/3
*{$symbol;}{'CODE'} || sub {
croak("Could not delegate $Class::Delegation::AUTOLOAD");
}
MC/DC0%0/2
*{$symbol;}{'CODE'} || sub {
croak("Could not delegate $Class::Delegation::AUTOLOAD");
}
*{$symbol;}{'CODE'}
sub {
croak("Could not delegate $Class::Delegation::AUTOLOAD");
}
Truth table66%2/3
A || B
A= *{$symbol;}{'CODE'}B= sub {
croak("Could not delegate $Class::Delegation::AUTOLOAD");
}
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | ▶ | local $SIG{__WARN__} = sub {}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 25 | ▶ | *$symbol = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=23 SCAR=33.7
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 25 | $$symbol = $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 25 | my ($class, $method) = $AUTOLOAD =~ m/(.*::)(.*)/; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 25 | my ($invocant, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 25 | ▶ | print STDERR "Delegating: $AUTOLOAD...\n" if ::DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | use Data::Dumper 'Dumper'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 25 | ▶ | print STDERR "...on: ", Dumper $invocant if ::DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 25 | my @context = ($invocant, $method, @args); | |||||||||||||||||||||||||||||||||||||||||
| 44 | 25 | ▶ | $invocant = "${class}${invocant}" unless ref $invocant; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 25 | my $wantarray = wantarray; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 25 | my @delegators = _delegators_for(@context); | |||||||||||||||||||||||||||||||||||||||||
| 47 | 25 | ▶ | goto &{$real_AUTOLOAD} unless @delegators; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 23 | my (@results, $delegated); | |||||||||||||||||||||||||||||||||||||||||
| 49 | 23 | DELEGATOR: foreach my $delegator ( @delegators ) { | |||||||||||||||||||||||||||||||||||||||||
| 50 | 23 | ▶ | next if $delegator->{other} && keys %$delegated; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$delegator->{"other"} and keys %$delegated
MC/DC0%0/2
$delegator->{"other"} and keys %$delegated
$delegator->{"other"}
keys %$delegated
Truth table33%1/3
A and B
A= $delegator->{"other"}B= keys %$delegated
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 23 | my @to = @{$delegator->{to}}; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 23 | my @as = @{$delegator->{as}}; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 23 | ▶ | if (@to==1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 15 | ▶ | print STDERR "[$to[0]]\n" if ::DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 15 | ▶ | next DELEGATOR if exists $delegated->{$to[0]}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 15 | foreach my $as (@as) { | |||||||||||||||||||||||||||||||||||||||||
| 57 | 17 | push @results, delegate($delegated,$wantarray,$invocant,$to[0],$as,\@args); | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | elsif (@as==1) { | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 6 | ▶ | print STDERR "[$to[0]]\n" if ::DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 6 | foreach my $to (@to) { | |||||||||||||||||||||||||||||||||||||||||
| 63 | 15 | ▶ | next if exists $delegated->{$to}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 15 | push @results, delegate($delegated,$wantarray,$invocant,$to,$as[0],\@args); | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 69 | 6 | ▶ | last unless @to && @as; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@to and @as
MC/DC50%1/2
@to and @as
@to
@as
Truth table66%2/3
A and B
A= @toB= @as
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 4 | my $to = shift @to; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | my $as = shift @as; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 4 | ▶ | next if exists $delegated->{$to}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 4 | push @results, delegate($delegated,$wantarray,$invocant,$to,$as,\@args); | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | goto &{$real_AUTOLOAD} unless keys %$delegated; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | return $wantarray | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | ? ( @results>1 ? @results : @{$results[0]} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | : ( @results>1 ? \@results : $results[0] ); | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 2 | ▶ | unless ($class->can('DESTROY') || _delegators_for($class,'DESTROY')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class->can("DESTROY") or _delegators_for($class, "DESTROY")
MC/DC0%0/2
$class->can("DESTROY") or _delegators_for($class, "DESTROY")
$class->can("DESTROY")
_delegators_for($class, "DESTROY")
Truth table33%1/3
A or B
A= $class->can("DESTROY")B= _delegators_for($class, "DESTROY")
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | *{"${class}::DESTROY"} = sub {}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 36 | ▶ | sub delegate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delegate: called CC=8 SCAR=21.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 36 | my ($delegated,$wantarray,$invocant,$to,$as,$args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | my $target = ref $to ? $to | ||||||||||||||||||||||||||||||||||||||||||
| 92 | : $to =~ /^->(\w+)$/ ? $invocant->$+() | ||||||||||||||||||||||||||||||||||||||||||
| 93 | : $to eq -SELF ? $invocant | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 36 | ▶ | : $invocant->{$to}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 36 | ▶ | return unless eval { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 36 | ▶ | $target->can($as) || $target->can('AUTOLOAD') | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$target->can($as) || $target->can('AUTOLOAD')
MC/DC0%0/2
$target->can($as) || $target->can('AUTOLOAD')
$target->can($as)
$target->can('AUTOLOAD')
Truth table33%1/3
A || B
A= $target->can($as)B= $target->can('AUTOLOAD')
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 36 | ▶ | my $result = $wantarray | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | ? [$target->$as(@$args)] | ||||||||||||||||||||||||||||||||||||||||||
| 100 | : $target->$as(@$args); | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 36 | ▶ | return if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 36 | $_[0]->{$to}++; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 36 | return $result | |||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 25 | ▶ | sub _delegators_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_delegators_for: called CC=8 SCAR=23.4
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 25 | my ($self, $method, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 25 | my @attrs; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 25 | ▶ | my $class = ref($self)||$self; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 25 | foreach my $candidate ( @{$mappings{$class}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 112 | push @attrs, $candidate->{send}->can_send(scalar(@attrs), | ||||||||||||||||||||||||||||||||||||||||||
| 113 | $candidate->{to}, | ||||||||||||||||||||||||||||||||||||||||||
| 114 | $candidate->{as}, | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 433 | @_); | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 25 | ▶ | return @attrs if @attrs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | my @ancestors = @{$class.'::ISA'}; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | my $parent; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 2 | ▶ | while ($parent = shift @ancestors) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | ▶ | next unless exists $mappings{$parent}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | foreach my $candidate ( @{$mappings{$parent}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 124 | push @attrs, $candidate->{send}->can_send(scalar(@attrs), | ||||||||||||||||||||||||||||||||||||||||||
| 125 | $candidate->{to}, | ||||||||||||||||||||||||||||||||||||||||||
| 126 | $candidate->{as}, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | @_); | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | return @attrs if @attrs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | unshift @ancestors, @{$parent.'::ISA'}; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 2 | return @attrs; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 19 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=10 SCAR=23.5
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 19 | my ($class, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 19 | my ($send, $send_val) = splice @$args, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 19 | ▶ | croak "Expected 'send => <method spec>' but found '$send => $send_val'" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | unless $send eq 'send'; | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 19 | ▶ | croak "The expected 'to => <attribute spec>' is missing at end of list" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | unless @$args >= 2; | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 19 | my ($to, $to_val) = splice @$args, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 19 | ▶ | croak "Expected 'to => <attribute spec>' but found '$to => $to_val'" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | unless $to eq 'to'; | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 19 | $send_val = _class_for(Send => $send_val)->_new($send_val); | |||||||||||||||||||||||||||||||||||||||||
| 147 | 19 | my $to_obj = _class_for(To => $to_val)->_new($to_val); | |||||||||||||||||||||||||||||||||||||||||
| 148 | 19 | my $self = bless { send=>$send_val, to=>$to_obj }, $class; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 19 | ▶ | if (($args->[0]||"") eq 'as') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$args->[0] || ''
MC/DC100%1/1
$args->[0] || ''
$args->[0]
Truth table100%2/2
A
A= $args->[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 14 | my ($as, $as_val) = splice @$args, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 151 | 14 | ▶ | croak "Arrays specified for 'to' and 'as' must be same length" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
ref $to_val ne "ARRAY" or ref $as_val ne "ARRAY" or @$to_val == @$as_val
ref $to_val ne "ARRAY" or ref $as_val ne "ARRAY"
MC/DC0%0/3
ref $to_val ne "ARRAY" or ref $as_val ne "ARRAY" or @$to_val == @$as_val
ref $to_val ne "ARRAY"
ref $as_val ne "ARRAY"
@$to_val == @$as_val
Truth table75%3/4
A or B or C
A= ref $to_val ne "ARRAY"B= ref $as_val ne "ARRAY"C= @$to_val == @$as_val
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | unless ref($to_val) ne 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 153 | || ref($as_val) ne 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 154 | || @$to_val == @$as_val; | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 14 | $self->{as} = _class_for(As => $as_val)->_new($as_val); | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 5 | ▶ | croak "'to => -SELF' is meaningless without 'as => <new_name>'" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | if $to_val eq -SELF; | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 5 | $self->{as} = Class::Delegation::As::Sent->_new(); | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 19 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | my %allowed; | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | @{$allowed{Send}}{qw(ARRAY Regexp CODE)} = (); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 4 | @{$allowed{To}}{qw(ARRAY Regexp CODE)} = (); | |||||||||||||||||||||||||||||||||||||||||
| 168 | 4 | @{$allowed{As}}{qw(ARRAY CODE)} = (); | |||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 57 | ▶ | sub _class_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_class_for: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 57 | my ($subclass, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 57 | my $type = ref($value); | |||||||||||||||||||||||||||||||||||||||||
| 173 | 57 | ▶ | return "Class::Delegation::${subclass}::SCALAR" unless $type; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | croak "'\l$subclass' value cannot be $type reference" | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 21 | ▶ | unless exists $allowed{$subclass}{$type}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 21 | return "Class::Delegation::${subclass}::${type}"; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | package # Hide from CPAN indexer | ||||||||||||||||||||||||||||||||||||||||||
| 180 | SELF; | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | sub DESTROY {} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | my ($name) = $SELF::AUTOLOAD =~ m/.*::(.+)/; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | bless \$name, 'SELF' | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 4 | ▶ | use overload 'neg' => sub { "->${$_[0]}" }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | package Class::Delegation::Send::SCALAR; | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 18 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 18 | ▶ | return bless {}, "Class::Delegation::Send::ALL" if $_[1] eq '-ALL'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 18 | ▶ | return bless {}, "Class::Delegation::Send::OTHER" if $_[-1] eq '-OTHER'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 18 | my $val = pop; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 18 | return bless \$val, $_[0] | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 409 | ▶ | sub can_send { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_send: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 409 | my ($self, $sent, $to, $as, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 409 | ▶ | return { to => [$to->attr_for(@context)], | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | as => [$as->name_for(@context)], | ||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | if $$self eq $context[1]; | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 391 | return; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | package Class::Delegation::Send::ARRAY; | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | my @delegators = | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | map { Class::Delegation::_class_for(Send => $_)->_new($_) } @{$_[1]}; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 2 | bless \@delegators, $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 48 | ▶ | sub can_send { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_send: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 48 | my ($self, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 48 | return map { $_->can_send(@context) } @$self; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | package Class::Delegation::Send::Regexp; | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 2 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 2 | my ($class, $regex) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 2 | my $self = bless \$regex, $class; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 48 | ▶ | sub can_send { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_send: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 48 | my ($self, $sent, $to, $as, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 48 | ▶ | return { to => [$to->attr_for(@context)], | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | as => [$as->name_for(@context)], | ||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | if $context[1] =~ $$self; | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 45 | return; | |||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | package Class::Delegation::Send::CODE; | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | ▶ | sub _new { bless $_[1], $_[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 48 | ▶ | sub can_send { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_send: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 48 | my ($self, $sent, $to, $as, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 48 | ▶ | return { to => [$to->attr_for(@context)], | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | as => [$as->name_for(@context)], | ||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | if $self->(@context); | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 46 | return; | |||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | package Class::Delegation::Send::ALL; | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub can_send { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_send: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my ($self, $sent, $to, $as, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | return { to => [$to->attr_for(@context)], | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | as => [$as->name_for(@context)], | ||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | if $context[1] ne 'DESTROY'; | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | package Class::Delegation::Send::OTHER; | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | sub can_send { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_send: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my ($self, $sent, $to, $as, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | return { to => [$to->attr_for(@context)], | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | as => [$as->name_for(@context)], | ||||||||||||||||||||||||||||||||||||||||||
| 272 | other => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | if $context[1] ne 'DESTROY'; | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | package Class::Delegation::To::SCALAR; | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 20 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 20 | my ($class, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 283 | 20 | ▶ | return bless {}, "Class::Delegation::To::ALL" if $value eq '-ALL'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 20 | return bless \$value, $class | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 24 | ▶ | sub attr_for { return ${$_[0]} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attr_for: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | package Class::Delegation::To::ARRAY; | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 5 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 5 | my ($class, $array) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 294 | 5 | ▶ | bless [ map {("Class::Delegation::To::".(ref||"SCALAR"))->_new($_)} @$array ], $class; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
ref $_ || 'SCALAR'
MC/DC100%1/1
ref $_ || 'SCALAR'
ref $_
Truth table100%2/2
A
A= ref $_
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 7 | ▶ | sub attr_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attr_for: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 7 | my ($self, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 299 | 7 | return map { $_->attr_for(@context) } @$self; | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | package Class::Delegation::To::Regexp; | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 2 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 2 | my ($class, $regex) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 2 | my $self = bless \$regex, $class; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 4 | ▶ | sub attr_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attr_for: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 4 | my ($self, $invocant, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 4 | ▶ | print STDERR "[[$$self]]\n" if ::DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 4 | return grep { $_ =~ $$self } keys %$invocant; | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | package Class::Delegation::To::CODE; | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | ▶ | sub _new { bless $_[1], $_[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 2 | ▶ | sub attr_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attr_for: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 2 | my ($self, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 323 | 2 | return $self->(@context) | |||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | package Class::Delegation::To::ALL; | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub attr_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attr_for: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my ($self, $invocant, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | return keys %$invocant; | |||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | package Class::Delegation::As::SCALAR; | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 7 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 7 | my ($class, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 340 | 7 | bless \$value, $class; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 7 | ▶ | sub name_for { ${$_[0]} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name_for: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | package Class::Delegation::As::ARRAY; | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 4 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 4 | my ($class, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 349 | 4 | bless $value, $class; | |||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 4 | ▶ | sub name_for { @{$_[0]} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name_for: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | package Class::Delegation::As::Sent; | ||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 5 | ▶ | sub _new { bless {}, $_[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 6 | ▶ | sub name_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name_for: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 6 | my ($self, $invocant, $method) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 6 | return $method; | |||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | package Class::Delegation::As::CODE; | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 3 | ▶ | sub _new { bless $_[1], $_[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 6 | ▶ | sub name_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name_for: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 6 | my ($self, @context) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 370 | 6 | return $self->(@context) | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | __END__ | ||||||||||||||||||||||||||||||||||||||||||