| 1 | # This code is part of Perl distribution Mail-Message version 4.05. | ||||||||||||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.06. | ||||||||||||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | # This software is copyright (c) 2001-2026 by Mark Overmeer. | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | package Mail::Message::Convert::MimeEntity;{ | ||||||||||||||||||||
| 13 | 1 | our $VERSION = '4.05'; | |||||||||||||||||||
| 14 | } | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | ▶ | use parent 'Mail::Message::Convert'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 1 | ▶ | use Log::Report 'mail-message', import => [ qw/__x error/ ]; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | ▶ | use MIME::Entity (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 1 | ▶ | use MIME::Parser (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 1 | ▶ | use Mail::Message (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | #-------------------- | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | sub export($$;$) | ||||||||||||||||||||
| 31 | 2 | ▶ | { my ($self, $message, $parser) = @_; | ||||||||||||||||||
|
Subroutine
export: called CC=4 SCAR=15.2
Pod
documented
| |||||||||||||||||||||
| 32 | 2 | ▶ | defined $message or return (); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 2 | ▶ | $message->isa('Mail::Message') | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 35 | or error __x"export message must be a Mail::Message object, but is {what UNKNOWN}.", what => $message; | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 2 | ▶ | $parser ||= MIME::Parser->new; | ||||||||||||||||||
|
Condition33%1/3
$parser ||= "MIME::Parser"->new
MC/DC0%0/2
$parser ||= "MIME::Parser"->new
$parser
"MIME::Parser"->new
Truth table33%1/3
A ||= B
A= $parserB= "MIME::Parser"->new
| |||||||||||||||||||||
| 38 | 2 | $parser->parse($message->file); | |||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | sub from($) | ||||||||||||||||||||
| 43 | 2 | ▶ | { my ($self, $mime_ent) = @_; | ||||||||||||||||||
|
Subroutine
from: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||
| 44 | 2 | ▶ | defined $mime_ent or return (); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 2 | ▶ | $mime_ent->isa('MIME::Entity') | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 47 | or error __x"converting from MIME::Entity but got a {class}.", class => ref $mime_ent; | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 2 | Mail::Message->read($mime_ent->as_string); | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 1 | 1; | |||||||||||||||||||