File Coverage

lib/Test/Tester/Delegate.pm
Criterion Covered Total %
statement 26 27 96.3
branch 2 4 50.0
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 35 40 87.5


line stmt bran cond sub pod time code
1 6     6   38 use strict;
  6         13  
  6         164  
2 6     6   28 use warnings;
  6         11  
  6         294  
3              
4             package Test::Tester::Delegate;
5              
6             our $VERSION = '1.302180';
7              
8 6     6   49 use Scalar::Util();
  6         13  
  6         106  
9              
10 6     6   40 use vars '$AUTOLOAD';
  6         13  
  6         1558  
11              
12             sub new
13             {
14 6     6 0 12 my $pkg = shift;
15              
16 6         14 my $obj = shift;
17 6         13 my $self = bless {}, $pkg;
18              
19 6         18 return $self;
20             }
21              
22             sub AUTOLOAD
23             {
24 73     73   1029 my ($sub) = $AUTOLOAD =~ /.*::(.*?)$/;
25              
26 73 50       189 return if $sub eq "DESTROY";
27              
28 73         149 my $obj = $_[0]->{Object};
29              
30 73         230 my $ref = $obj->can($sub);
31 73         177 shift(@_);
32 73         137 unshift(@_, $obj);
33 73         282 goto &$ref;
34             }
35              
36             sub can {
37 1     1 0 7 my $this = shift;
38 1         3 my ($sub) = @_;
39              
40 1 50       13 return $this->{Object}->can($sub) if Scalar::Util::blessed($this);
41              
42 0           return $this->SUPER::can(@_);
43             }
44              
45             1;