File Coverage

blib/lib/Error/Pure/Always.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 21 21 100.0


line stmt bran cond sub pod time code
1             package Error::Pure::Always;
2              
3             # Pragmas.
4 3     3   43375 use strict;
  3         6  
  3         77  
5 3     3   14 use warnings;
  3         5  
  3         78  
6              
7             # Modules.
8 3     3   1925 use Error::Pure qw(err);
  3         37513  
  3         60  
9              
10             # Version.
11             our $VERSION = 0.06;
12              
13             my %OLD_SIG;
14              
15             # Default error type.
16             $ENV{'ERROR_PURE_TYPE'} ||= 'Die';
17              
18             BEGIN {
19 3     3   434 @OLD_SIG{qw(__DIE__)} = @SIG{qw(__DIE__)};
20             $SIG{__DIE__} = sub {
21 14         65679 my $err = shift;
22 14         91 $err =~ s/ at .*\n//ms;
23 14         24 $Error::Pure::LEVEL = 5;
24 14         58 err $err;
25 3         144 };
26             }
27              
28             END {
29 3     3   856 @SIG{qw(__DIE__)} = @OLD_SIG{qw(__DIE__)};
30             }
31              
32             1;
33              
34             __END__