| 1 | package MIME::Expander::Plugin::MessageRFC822; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | $VERSION = '0.01'; | |||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use parent qw(MIME::Expander::Plugin); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 4 | __PACKAGE__->mk_classdata('ACCEPT_TYPES' => [qw( | |||||||||
| 10 | message/rfc822 | ||||||||||
| 11 | )]); | ||||||||||
| 12 | |||||||||||
| 13 | 4 | ▶ | use Email::MIME; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | sub expand { | ||||||||||
| 16 | 4 | ▶ | my $self = shift; | ||||||||
|
Subroutine
expand: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||
| 17 | 4 | my $contents = shift; | |||||||||
| 18 | 4 | my $callback = shift; | |||||||||
| 19 | 4 | my $c = 0; | |||||||||
| 20 | |||||||||||
| 21 | 4 | ▶ | my @parts = (Email::MIME->new( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | ref $contents eq 'SCALAR' ? $contents : \$contents | ||||||||||
| 23 | )); | ||||||||||
| 24 | 4 | ▶ | while( my $part = shift @parts ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 18 | ▶ | if( 1 < $part->parts ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 4 | push @parts, $part->subparts; | |||||||||
| 27 | }else{ | ||||||||||
| 28 | 14 | ++$c; | |||||||||
| 29 | 14 | ▶ | $callback->( \$part->body, { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | filename => $part->filename, | ||||||||||
| 31 | } ) if( ref $callback eq 'CODE' ); | ||||||||||
| 32 | } | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 4 | return $c; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 4 | 1; | |||||||||
| 39 | __END__ | ||||||||||