File Coverage

blib/lib/Net/ACME2/AccessorBase.pm
Criterion Covered Total %
statement 16 17 94.1
branch 4 6 66.6
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 24 28 85.7


line stmt bran cond sub pod time code
1             package Net::ACME2::AccessorBase;
2              
3 3     3   910 use strict;
  3         6  
  3         59  
4 3     3   11 use warnings;
  3         14  
  3         505  
5              
6             our $AUTOLOAD;
7              
8             sub new {
9 2     2 0 89 my ($class, %opts) = @_;
10              
11 2         14 $opts{"_$_"} = delete $opts{$_} for keys %opts;
12              
13 2         7 return bless \%opts, $class;
14             }
15              
16             sub AUTOLOAD {
17 8     8   9736 my ($self) = @_;
18              
19 8 50       49 $AUTOLOAD =~ m<(.+)::(.+)> or die "Weird func name: “$AUTOLOAD”!";
20 8         36 my ($class, $method) = ($1, $2);
21              
22 8 100       32 if ( grep { $method eq $_ } $self->_ACCESSORS() ) {
  48         87  
23 6         35 return $self->{"_$method"};
24             }
25              
26 2 50       273 return if $method eq 'DESTROY';
27              
28 0           die "“$class” doesn’t define a method “$method”!";
29             }
30              
31             1;