File Coverage

blib/lib/Crypt/OpenPGP/ErrorHandler.pm
Criterion Covered Total %
statement 13 14 92.8
branch 6 6 100.0
condition n/a
subroutine 4 5 80.0
pod 2 3 66.6
total 25 28 89.2


line stmt bran cond sub pod time code
1             package Crypt::OpenPGP::ErrorHandler;
2 16     16   103 use strict;
  16         32  
  16         619  
3 16     16   76 use warnings;
  16         81  
  16         4289  
4              
5             our $VERSION = '1.19'; # VERSION
6              
7             our $ERROR;
8              
9 0     0 0 0 sub new { bless {}, shift }
10             sub error {
11 30     30 1 100 my $msg = $_[1];
12 30 100       210 $msg .= "\n" unless $msg =~ /\n$/;
13 30 100       108 if (ref($_[0])) {
14 26         80 $_[0]->{_errstr} = $msg;
15             } else {
16 4         9 $ERROR = $msg;
17             }
18 30         122 return;
19             }
20 5 100   5 1 362 sub errstr { ref($_[0]) ? $_[0]->{_errstr} : $ERROR }
21              
22             1;
23             __END__