| 1 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | package Exception::Reporter::Summarizer::Email; | ||
| 4 | # ABSTRACT: a summarizer for Email::Simple objects | ||
| 5 | 1 | $Exception::Reporter::Summarizer::Email::VERSION = '0.014'; | |
| 6 | 1 | ▶ | use parent 'Exception::Reporter::Summarizer'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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<message/rfc822> data containing the | ||
| 12 | #pod stringification of the message. | ||
| 13 | #pod | ||
| 14 | #pod =cut | ||
| 15 | |||
| 16 | 1 | ▶ | use Try::Tiny; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | sub can_summarize { | ||
| 19 | 14 | ▶ | my ($self, $entry) = @_; |
|
Subroutine
can_summarize: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 20 | 14 | ▶ | return try { $entry->[1]->isa('Email::Simple') }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 21 | } | ||
| 22 | |||
| 23 | sub summarize { | ||
| 24 | 2 | ▶ | my ($self, $entry) = @_; |
|
Subroutine
summarize: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 25 | 2 | my ($name, $value, $arg) = @$entry; | |
| 26 | |||
| 27 | 2 | my $fn_base = $self->sanitize_filename($name); | |
| 28 | |||
| 29 | return { | ||
| 30 | 2 | 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 | 1; | |
| 39 | |||
| 40 | __END__ | ||