File Coverage

blib/lib/Exception/Reporter/Summarizer/Email.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 26 28 92.8


line stmt bran cond sub pod time code
1 1     1   534 use strict;
  1         4  
  1         29  
2 1     1   6 use warnings;
  1         2  
  1         47  
3             package Exception::Reporter::Summarizer::Email 0.015;
4             # ABSTRACT: a summarizer for Email::Simple objects
5              
6 1     1   6 use parent 'Exception::Reporter::Summarizer';
  1         2  
  1         7  
7              
8             #pod =head1 OVERVIEW
9             #pod
10             #pod This summarizer will only summarize Email::Simple (or subclass) objects. The
11             #pod emails will be summarized as C data containing the
12             #pod stringification of the message.
13             #pod
14             #pod =cut
15              
16 1     1   47 use Try::Tiny;
  1         3  
  1         205  
17              
18             sub can_summarize {
19 14     14 0 34 my ($self, $entry) = @_;
20 14     14   69 return try { $entry->[1]->isa('Email::Simple') };
  14         432  
21             }
22              
23             sub summarize {
24 2     2 0 9 my ($self, $entry) = @_;
25 2         7 my ($name, $value, $arg) = @$entry;
26              
27 2         9 my $fn_base = $self->sanitize_filename($name);
28              
29             return {
30 2         18 filename => "$fn_base.msg",
31             mimetype => 'message/rfc822',
32             ident => "email message for $fn_base",
33             body => $value->as_string,
34             body_is_bytes => 1,
35             };
36             }
37              
38             1;
39              
40             __END__