Message/Convert/MimeEntity.pm

filter: Statementstmt 100% 33 / 33 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 2 / 2 totaltotal 85.9% 49 / 57 CC 6 SCAR 9.1
CC
6
Cov
86%
export
4.6
from
3.1
BEGIN
1.0
CRAP 2.5
« Box/Parser.pm ↑ Summary Message/Field/Fast.pm »
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
BranchTrueFalseTotal
defined $message or return () 2 0 2
33  
34 2 ▶ $message->isa('Mail::Message')
Branch: 1 branch
BranchTrueFalseTotal
$message->isa("Mail::Message") or &error(&__x("export message must be a Mail::Message object, but is {what UNKNOWN}.", "what", $message)) 2 0 2
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
l!l&&r!l&&!r
020
MC/DC0%0/2
$parser ||= "MIME::Parser"->new
$parser "MIME::Parser"->new
Truth table33%1/3
A ||= B
A= $parserB= "MIME::Parser"->new
ABresult
1X1
011
000
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
BranchTrueFalseTotal
defined $mime_ent or return () 2 0 2
45  
46 2 ▶ $mime_ent->isa('MIME::Entity')
Branch: 1 branch
BranchTrueFalseTotal
$mime_ent->isa("MIME::Entity") or &error(&__x("converting from MIME::Entity but got a {class}.", "class", ref $mime_ent)) 2 0 2
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;
« Box/Parser.pm ↑ Summary Message/Field/Fast.pm »