| 1 | 13 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 13 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | package Template::Pure::DataProxy; | ||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 13 | ▶ | use Scalar::Util; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 13 | ▶ | use Data::Dumper; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | sub new { | ||||||||||||||||||||
| 10 | 4 | ▶ | my ($proto, $data, %extra) = @_; | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 11 | 4 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 12 | 4 | bless +{ | |||||||||||||||||||
| 13 | data => $data, | ||||||||||||||||||||
| 14 | extra => \%extra, | ||||||||||||||||||||
| 15 | }, $class; | ||||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 7 | ▶ | sub can { 1 } # Evil, sorry | ||||||||||||||||||
|
Subroutine
can: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | sub AUTOLOAD { | ||||||||||||||||||||
| 21 | 11 | ▶ | return if our $AUTOLOAD =~ /DESTROY/; | ||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=7 SCAR=24.6
Branch: 1 branch
| |||||||||||||||||||||
| 22 | 7 | my $self = shift; | |||||||||||||||||||
| 23 | 7 | ( my $method = $AUTOLOAD ) =~ s{.*::}{}; | |||||||||||||||||||
| 24 | 7 | ▶ | if(Scalar::Util::blessed $self->{data}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 25 | 0 | ▶ | if($self->{data}->can($method)) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 26 | 0 | return $self->{data}->$method; | |||||||||||||||||||
| 27 | } elsif(exists $self->{extra}{$method}) { | ||||||||||||||||||||
| 28 | 0 | return $self->{extra}{$method}; | |||||||||||||||||||
| 29 | } else { | ||||||||||||||||||||
| 30 | 0 | die "No value at $method for $self"; | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | } else { | ||||||||||||||||||||
| 33 | ## I think we can assume its a hashref then. | ||||||||||||||||||||
| 34 | 7 | ▶ | if(exists $self->{data}{$method}) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 35 | 5 | return $self->{data}{$method}; | |||||||||||||||||||
| 36 | } elsif(exists $self->{extra}{$method}) { | ||||||||||||||||||||
| 37 | 2 | return $self->{extra}{$method}; | |||||||||||||||||||
| 38 | } else { | ||||||||||||||||||||
| 39 | 0 | die "No value at $method in: ".Dumper $self; | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 13 | 1; | |||||||||||||||||||
| 45 | |||||||||||||||||||||