File Coverage

lib/List/Objects/WithUtils/Hash/Inflated.pm
Criterion Covered Total %
statement 27 29 93.1
branch 11 12 91.7
condition n/a
subroutine 8 9 88.9
total 46 50 92.0


line stmt bran cond sub code
1         package List::Objects::WithUtils::Hash::Inflated;
2 2     2 use strictures 1;
  2        
  2        
3 2     2 use Carp ();
  2        
  2        
4 2     2 use Scalar::Util ();
  2        
  2        
5          
6         sub new {
7 3     3   bless +{ @_[1 .. $#_] }, $_[0]
8         }
9          
10 1     1 sub DEFLATE { %{ $_[0] } }
  1        
11          
12         our $AUTOLOAD;
13          
14         sub can {
15 7     7   my ($self, $method) = @_;
16 7 100       if (my $sub = $self->SUPER::can($method)) {
17 1           return $sub
18           }
19 6 100       return unless exists $self->{$method};
20           sub {
21 1     1     my ($self) = @_;
22 1 50         if (my $sub = $self->SUPER::can($method)) {
23 0             goto $sub
24             }
25 1           $AUTOLOAD = $method;
26 1           goto &AUTOLOAD
27           }
28 1       }
29          
30         sub AUTOLOAD {
31 7     7   my $self = shift;
32 7         ( my $method = $AUTOLOAD ) =~ s/.*:://;
33 7 100       Scalar::Util::blessed($self)
34             or Carp::confess "Not a class method: '$method'";
35           
36 6 100       Carp::confess "Can't locate object method '$method'"
37             unless exists $self->{$method};
38 5 100       Carp::confess "Accessor '$method' is read-only"
39             if @_;
40          
41 4         $self->{$method}
42         }
43          
44 0     0 sub DESTROY {}
45          
46         1;
47          
48         =pod
49        
50         =for Pod::Coverage new can AUTOLOAD DEFLATE
51        
52         =cut
53