File Coverage

blib/lib/DBIx/Poggy/Error.pm
Criterion Covered Total %
statement 9 16 56.2
branch n/a
condition 0 5 0.0
subroutine 3 5 60.0
pod 0 1 0.0
total 12 27 44.4


line stmt bran cond sub pod time code
1 1     1   1371 use strict;
  1         1  
  1         23  
2 1     1   4 use warnings;
  1         1  
  1         96  
3              
4             package DBIx::Poggy::Error;
5              
6             my @fields = qw(err errstr state);
7              
8             sub new {
9 0     0 0   my $proto = shift;
10 0   0       my $dbh = shift || 'DBI';
11 0   0       my $self = bless {}, ref($proto) || $proto;
12 0           foreach my $f ( @fields ) {
13 0           $self->{$f} = $dbh->$f();
14             }
15 0           return $self;
16             }
17              
18             foreach my $f ( @fields ) {
19 1     1   3 no strict 'refs';
  1         4  
  1         54  
20 0     0     *{$f} = sub { return $_[0]->{$f} };
21             }
22              
23             1;