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   1250 use 5.010;
  1         4  
  1         46  
4 1     1   6 use strict;
  1         3  
  1         39  
5 1     1   6 use warnings;
  1         2  
  1         33  
6              
7 1     1   5 use Carp 'confess';
  1         2  
  1         69  
8 1     1   6 use Data::Object 'type_code';
  1         2  
  1         48  
9 1     1   6 use Scalar::Util 'blessed';
  1         2  
  1         279  
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;