| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 1 |  |  | 1 |  | 823 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 37 |  | 
| 2 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 218 |  | 
| 3 |  |  |  |  |  |  | package Email::Pipemailer::DieHandler; | 
| 4 |  |  |  |  |  |  | { | 
| 5 |  |  |  |  |  |  | $Email::Pipemailer::DieHandler::VERSION = '1.001'; | 
| 6 |  |  |  |  |  |  | } | 
| 7 |  |  |  |  |  |  | # ABSTRACT: do not die embarassingly if you screw up your pipemailer | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub import { | 
| 11 | 0 |  |  | 0 |  |  | my ($self, $install, $arg) = @_; | 
| 12 | 0 | 0 | 0 |  |  |  | return unless $install and $install eq '-install'; | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 0 |  | 0 |  |  |  | $arg ||= {}; | 
| 15 | 0 |  | 0 | 0 |  |  | my $logger = $arg->{logger} || sub {}; | 
|  | 0 |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | $SIG{__DIE__} = sub { | 
| 18 | 0 | 0 |  | 0 |  |  | return if $^S; # don't interfere with evals | 
| 19 | 0 |  |  |  |  |  | my ($e) = @_; | 
| 20 | 0 | 0 |  |  |  |  | defined $^S and eval { $logger->($e); }; | 
|  | 0 |  |  |  |  |  |  | 
| 21 | 0 |  |  |  |  |  | $! = 75; | 
| 22 | 0 |  |  |  |  |  | die $e; | 
| 23 | 0 |  |  |  |  |  | }; | 
| 24 |  |  |  |  |  |  | } | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | 1; | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | __END__ |