File Coverage

blib/lib/Data/Object/Autobox/Autoload/Code.pm
Criterion Covered Total %
statement 18 24 75.0
branch 0 4 0.0
condition 0 3 0.0
subroutine 6 7 85.7
pod n/a
total 24 38 63.1


line stmt bran cond sub pod time code
1             package Data::Object::Autobox::Autoload::Code;
2              
3 1     1   841 use 5.010;
  1         2  
  1         31  
4 1     1   4 use strict;
  1         1  
  1         22  
5 1     1   3 use warnings;
  1         1  
  1         20  
6              
7 1     1   3 use Carp 'confess';
  1         1  
  1         42  
8 1     1   4 use Data::Object 'type_code';
  1         1  
  1         36  
9 1     1   4 use Scalar::Util 'blessed';
  1         1  
  1         147  
10              
11             sub AUTOLOAD {
12 0     0     my ($package, $method) = our $AUTOLOAD =~ /^(.+)::(.+)$/;
13              
14 0           my $delegate = 'Data::Object::Code';
15 0           my $self = $_[0] = type_code $_[0];
16              
17 0 0 0       confess "Undefined subroutine &${delegate}::$method called"
18             unless blessed $self && $self->isa($delegate);
19              
20 0 0         confess "Can't locate object method \"$method\" via package \"$delegate\""
21             unless my $source = $self->can($method);
22              
23 0           goto $source; # delegate to Data::Object::Code ...
24             }
25              
26             1;