| 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;{ | ||||||||||||||||||||||||||||||||
| 13 | 5 | our $VERSION = '4.05'; | |||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 5 | ▶ | use Log::Report 'mail-message', import => [ qw// ]; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 5 | ▶ | use IO::Lines (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | #-------------------- | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | sub string() | ||||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
string: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||
| 28 | 5 | ▶ | $self->head->string . $self->body->string . ($self->endsOnNewline ? '' : "\n"); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | sub lines() | ||||||||||||||||||||||||||||||||
| 33 | 8 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
lines: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 34 | 8 | my @lines; | |||||||||||||||||||||||||||||||
| 35 | 8 | my $file = IO::Lines->new(\@lines); | |||||||||||||||||||||||||||||||
| 36 | 8 | $self->print($file); | |||||||||||||||||||||||||||||||
| 37 | 8 | ▶ | wantarray ? @lines : \@lines; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | sub file() | ||||||||||||||||||||||||||||||||
| 42 | 2 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
file: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 43 | 2 | my $file = IO::Lines->new; | |||||||||||||||||||||||||||||||
| 44 | 2 | $self->print($file); | |||||||||||||||||||||||||||||||
| 45 | 2 | $file->seek(0, 0); | |||||||||||||||||||||||||||||||
| 46 | 2 | $file; | |||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | sub printStructure(;$$) | ||||||||||||||||||||||||||||||||
| 51 | 6 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
printStructure: called CC=13 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 6 | ▶ | my $indent | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
defined $_[0] and not ref $_[0]
MC/DC0%0/2
defined $_[0] and not ref $_[0]
defined $_[0]
not ref $_[0]
Truth table33%1/3
A and not(B)
A= defined $_[0]B= not ref $_[0]
| |||||||||||||||||||||||||||||||||
| 54 | = @_==2 ? pop | ||||||||||||||||||||||||||||||||
| 55 | : defined $_[0] && !ref $_[0] ? shift | ||||||||||||||||||||||||||||||||
| 56 | : ''; | ||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||
| 58 | 6 | ▶ | my $fh = @_ ? shift : select; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | 6 | my $buffer; # only filled if filehandle==undef | |||||||||||||||||||||||||||||||
| 61 | 6 | ▶ | open $fh, '>:raw', \$buffer unless defined $fh; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | 6 | ▶ | my $subject = $self->get('Subject') || ''; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->get('Subject') || ''
MC/DC100%1/1
$self->get('Subject') || ''
$self->get('Subject')
Truth table100%2/2
A
A= $self->get('Subject')
| |||||||||||||||||||||||||||||||||
| 64 | 6 | ▶ | $subject = ": $subject" if length $subject; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | 6 | ▶ | my $type = $self->get('Content-Type', 0) || ''; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->get('Content-Type', 0) || ''
MC/DC0%0/1
$self->get('Content-Type', 0) || ''
$self->get('Content-Type', 0)
Truth table50%1/2
A
A= $self->get('Content-Type', 0)
| |||||||||||||||||||||||||||||||||
| 67 | 6 | my $size = $self->size; | |||||||||||||||||||||||||||||||
| 68 | 6 | ▶ | my $deleted = $self->label('deleted') ? ', deleted' : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 6 | my $text = "$indent$type$subject ($size bytes$deleted)\n"; | |||||||||||||||||||||||||||||||
| 71 | 6 | $fh->print($text); | |||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||
| 73 | 6 | my $body = $self->body; | |||||||||||||||||||||||||||||||
| 74 | my @parts | ||||||||||||||||||||||||||||||||
| 75 | 6 | ▶ | = $body->isNested ? ($body->nested) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 76 | : $body->isMultipart ? $body->parts | ||||||||||||||||||||||||||||||||
| 77 | : (); | ||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||
| 79 | $_->printStructure($fh, $indent.' ') | ||||||||||||||||||||||||||||||||
| 80 | 6 | for @parts; | |||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||
| 82 | 6 | $buffer; | |||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | #-------------------- | ||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | 5 | 1; | |||||||||||||||||||||||||||||||