File Coverage

blib/lib/Net/ACME/AccessorBase.pm
Criterion Covered Total %
statement 15 17 88.2
branch 2 6 33.3
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 21 28 75.0


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