| 1 | ##---------------------------------------------------------------------------- | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ## MIME Email Builder - ~/lib/Mail/Make.pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Version v0.22.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2026 DEGUEST Pte. Ltd. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ## Created 2026/03/02 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ## Modified 2026/03/18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ## All rights reserved | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ## | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ## | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | ## This program is free software; you can redistribute it and/or modify it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ## under the same terms as Perl itself. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ##---------------------------------------------------------------------------- | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | package Mail::Make; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | BEGIN | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | ▶ | use strict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | warnings::register_categories( 'Mail::Make' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | ▶ | use parent qw( Module::Generic ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | ▶ | use vars qw( $VERSION $EXCEPTION_CLASS $CRLF $MAX_BODY_IN_MEMORY_SIZE ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 6 | ▶ | use Mail::Make::Entity; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 6 | ▶ | use Mail::Make::Exception; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 6 | ▶ | use Mail::Make::Headers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 6 | ▶ | use Mail::Make::Headers::Subject; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 6 | ▶ | use Scalar::Util (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | our $CRLF = "\015\012"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | our $MAX_BODY_IN_MEMORY_SIZE = 1_048_576; # 1 MiB default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | our $EXCEPTION_CLASS = 'Mail::Make::Exception'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | our $VERSION = 'v0.22.0'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 6 | ▶ | use strict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 6 | ▶ | use warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | sub init | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 49 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # Top-level envelope headers live in a Mail::Make::Headers instance. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # All RFC 2822 envelope fields (From, To, Cc, Bcc, Subject, Date, Message-ID, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # In-Reply-To, References, Reply-To, Sender) are stored there directly, avoiding any | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # duplication between Mail::Make and the final Mail::Make::Entity's headers object. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 49 | $self->{_headers} = Mail::Make::Headers->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # Accumulated body parts (Mail::Make::Entity objects, in order of addition) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 49 | $self->{_parts} = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # When the serialised message exceeds this byte threshold (or when use_temp_file is true), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # as_string_ref() spools to a temporary file rather than keeping the entire message in RAM. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # Set to 0 or undef to disable file spooling entirely. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 49 | $self->{max_body_in_memory_size} = $MAX_BODY_IN_MEMORY_SIZE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 49 | $self->{use_temp_file} = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 49 | $self->{_exception_class} = $EXCEPTION_CLASS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 49 | $self->{_init_strict_use_sub} = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 49 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 49 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # as_entity() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # Returns the fully assembled top-level Mail::Make::Entity object. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # The MIME structure is chosen based on the accumulated parts: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # Only plain text -> text/plain | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # Only HTML -> text/html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # Plain + HTML -> multipart/alternative | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # Any of the above + inlines -> multipart/related | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # Any of the above + attachments -> multipart/mixed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | sub as_entity | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 54 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_entity: called CC=27 SCAR=33.4
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # When gpg_sign() / gpg_encrypt() / gpg_sign_encrypt() have already assembled the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # top-level entity (stored in _gpg_entity), return it directly. Envelope headers have | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # already been merged by _wrap_in_mail(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 54 | ▶ | return( $self->{_gpg_entity} ) if( defined( $self->{_gpg_entity} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # S/MIME: entity pre-assembled by Mail::Make::SMIME::_build_from_smime_output(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # Headers are already embedded in the parsed entity; return it directly. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 54 | ▶ | return( $self->{_smime_entity} ) if( defined( $self->{_smime_entity} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # Partition accumulated parts by role | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 54 | my( @plain, @html, @inline, @attachment ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 54 | for my $part ( @{$self->{_parts}} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 75 | ▶ | my $type = lc( $part->effective_type // '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$part->effective_type // ""
MC/DC0%0/1
$part->effective_type // ""
$part->effective_type
Truth table50%1/2
A
A= $part->effective_type
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # Use get() for the raw string value; content_disposition() returns a typed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # object which stringifies to '' when uninitialised, making // unreliable. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 75 | ▶ | my $cd = lc( $part->headers->get( 'Content-Disposition' ) // '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$part->headers->get("Content-Disposition") // ""
MC/DC100%1/1
$part->headers->get("Content-Disposition") // ""
$part->headers->get("Content-Disposition")
Truth table100%2/2
A
A= $part->headers->get("Content-Disposition")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 75 | ▶ | if( $type eq 'text/plain' && $cd !~ /attachment/ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$type eq "text/plain" and not $cd =~ /attachment/
MC/DC50%1/2
$type eq "text/plain" and not $cd =~ /attachment/
$type eq "text/plain"
not $cd =~ /attachment/
Truth table66%2/3
A and not(B)
A= $type eq "text/plain"B= not $cd =~ /attachment/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 50 | push( @plain, $part ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ▶ | elsif( $type eq 'text/html' && $cd !~ /attachment/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$type eq "text/html" and not $cd =~ /attachment/
MC/DC50%1/2
$type eq "text/html" and not $cd =~ /attachment/
$type eq "text/html"
not $cd =~ /attachment/
Truth table66%2/3
A and not(B)
A= $type eq "text/html"B= not $cd =~ /attachment/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 9 | push( @html, $part ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ▶ | elsif( $cd =~ /inline/ && $part->headers->get( 'Content-ID' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$cd =~ /inline/ and $part->headers->get("Content-ID")
MC/DC50%1/2
$cd =~ /inline/ and $part->headers->get("Content-ID")
$cd =~ /inline/
$part->headers->get("Content-ID")
Truth table66%2/3
A and B
A= $cd =~ /inline/B= $part->headers->get("Content-ID")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 6 | push( @inline, $part ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 10 | push( @attachment, $part ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # NOTE: Step 1: build the text body (plain, html, or alternative) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 54 | my $body_entity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 54 | ▶ | if( @plain && @html ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
@plain and @html
MC/DC100%2/2
@plain and @html
@plain
@html
Truth table100%3/3
A and B
A= @plainB= @html
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 6 | ▶ | $body_entity = Mail::Make::Entity->build( type => 'multipart/alternative' ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'Mail::Make::Entity'->build('type', 'multipart/alternative') || (return $self->pass_error('Mail::Make::Entity'->error))
MC/DC0%0/1
'Mail::Make::Entity'->build('type', 'multipart/alternative') || (return $self->pass_error('Mail::Make::Entity'->error))
'Mail::Make::Entity'->build('type', 'multipart/alternative')
Truth table50%1/2
A
A= 'Mail::Make::Entity'->build('type', 'multipart/alternative')
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | return( $self->pass_error( Mail::Make::Entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 6 | $body_entity->add_part( $_ ) for( @plain ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 6 | $body_entity->add_part( $_ ) for( @html ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | elsif( @html ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 3 | $body_entity = $html[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | elsif( @plain ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 44 | $body_entity = $plain[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1 | return( $self->error( "No body parts have been added." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # NOTE: Step 2: wrap in multipart/related if there are inline parts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 53 | my $related_entity = $body_entity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 53 | ▶ | if( @inline ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 6 | ▶ | $related_entity = Mail::Make::Entity->build( type => 'multipart/related' ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'Mail::Make::Entity'->build('type', 'multipart/related') || (return $self->pass_error('Mail::Make::Entity'->error))
MC/DC0%0/1
'Mail::Make::Entity'->build('type', 'multipart/related') || (return $self->pass_error('Mail::Make::Entity'->error))
'Mail::Make::Entity'->build('type', 'multipart/related')
Truth table50%1/2
A
A= 'Mail::Make::Entity'->build('type', 'multipart/related')
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | return( $self->pass_error( Mail::Make::Entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 6 | $related_entity->add_part( $body_entity ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 6 | $related_entity->add_part( $_ ) for( @inline ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # NOTE: Step 3: wrap in multipart/mixed if there are attachments | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 53 | my $top_entity = $related_entity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 53 | ▶ | if( @attachment ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 7 | ▶ | $top_entity = Mail::Make::Entity->build( type => 'multipart/mixed' ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'Mail::Make::Entity'->build('type', 'multipart/mixed') || (return $self->pass_error('Mail::Make::Entity'->error))
MC/DC0%0/1
'Mail::Make::Entity'->build('type', 'multipart/mixed') || (return $self->pass_error('Mail::Make::Entity'->error))
'Mail::Make::Entity'->build('type', 'multipart/mixed')
Truth table50%1/2
A
A= 'Mail::Make::Entity'->build('type', 'multipart/mixed')
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | return( $self->pass_error( Mail::Make::Entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 7 | $top_entity->add_part( $related_entity ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 7 | $top_entity->add_part( $_ ) for( @attachment ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # NOTE: Step 4: transfer envelope headers to the top-level entity | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # We merge our own _headers into the entity's headers object so that MIME-specific | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # headers already set on the entity (Content-Type, CTE, etc.) take precedence, while | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # envelope headers come from _headers. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # Any header already present in the entity headers is left untouched. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 53 | my $ent_headers = $top_entity->headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # Auto-generate Date if not set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | $self->{_headers}->init_header( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 53 | 'Date' => $self->_format_date() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # Auto-generate Message-ID if not set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 53 | ▶ | unless( $self->{_headers}->exists( 'Message-ID' ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | $self->{_headers}->message_id( { generate => 1, domain => $self->_default_domain } ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 45 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # MIME-Version is always added to the entity's own headers (not the envelope), since | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # it belongs at the top of the MIME structure. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 53 | $ent_headers->init_header( 'MIME-Version' => '1.0' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | # Merge envelope headers into the entity: each field from _headers that is not already | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # present in ent_headers is copied over. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | $self->{_headers}->scan( sub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 269 | ▶ | my( $name, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 269 | $ent_headers->init_header( $name => $value ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 269 | return(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 53 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 53 | return( $top_entity ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # as_string() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # Assembles the message and returns it as a plain string, consistent with | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # MIME::Entity::stringify. Use print($fh) to avoid loading the whole message into memory, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # or as_string_ref() to avoid a string copy. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | sub as_string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 26 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 26 | ▶ | my $entity = $self->as_entity || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->as_entity || (return $self->pass_error)
MC/DC100%1/1
$self->as_entity || (return $self->pass_error)
$self->as_entity
Truth table100%2/2
A
A= $self->as_entity
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 25 | return( $entity->as_string( @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # as_string_ref() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # Returns the assembled message as a scalar reference (no string copy). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # When use_temp_file is true, or the serialised entity size exceeds max_body_in_memory_size, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # the message is written to a Module::Generic::Scalar buffer, thus keeping peak RAM use | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # to a single copy rather than two overlapping buffers (the serialisation buffer plus the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | # returned string). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | sub as_string_ref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string_ref: not called CC=8 SCAR=42.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | my $entity = $self->as_entity || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->as_entity || (return $self->pass_error)
MC/DC0%0/1
$self->as_entity || (return $self->pass_error)
$self->as_entity
Truth table0%0/2
A
A= $self->as_entity
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $threshold = $self->{max_body_in_memory_size}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $force_file = $self->{use_temp_file}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # Fast path: build directly in memory when neither condition applies | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | unless( $force_file || ( defined( $threshold ) && $threshold > 0 && $entity->length > $threshold ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$force_file or defined $threshold and $threshold > 0 and $entity->length > $threshold
defined $threshold and $threshold > 0 and $entity->length > $threshold
defined $threshold and $threshold > 0
MC/DC0%0/4
$force_file or defined $threshold and $threshold > 0 and $entity->length > $threshold
$force_file
defined $threshold
$threshold > 0
$entity->length > $threshold
Truth table0%0/5
A or B and C and D
A= $force_fileB= defined $thresholdC= $threshold > 0D= $entity->length > $threshold
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | return( $entity->as_string_ref ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # new_scalar() is inherited from Module::Generic, and returns a Module::Generic::Scalar object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my $buf = $self->new_scalar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # In-memory fielhandle; returns a Module::Generic::Scalar::IO object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | my $fh = $buf->open( '>', { binmode => ':raw', autoflush => 1 } ) || return( $buf->error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$buf->open('>', {'binmode', ':raw', 'autoflush', 1}) || (return $buf->error)
MC/DC0%0/1
$buf->open('>', {'binmode', ':raw', 'autoflush', 1}) || (return $buf->error)
$buf->open('>', {'binmode', ':raw', 'autoflush', 1})
Truth table0%0/2
A
A= $buf->open('>', {'binmode', ':raw', 'autoflush', 1})
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | $entity->print( $fh ) || return( $self->pass_error( $entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # The scalar object stringifies as necessary. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | return( $buf ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | # attach( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # Adds a standard (downloadable) attachment. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # Recognised keys: path, data, type, filename, charset, encoding, description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | sub attach | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 11 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attach: called CC=10 SCAR=24.2
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # Detect positional shorthand: attach( '/path/to/file.pdf' ) or | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # attach( '/path/to/file.pdf', encoding => 'base64', ... ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # Triggered when argument count is odd and the first argument is a plain scalar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # (not a reference), contains no newline, and resolves to an existing file. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 11 | ▶ | if( ( scalar( @_ ) % 2 ) && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
scalar(@_) % 2 and !ref($_[0]) || $self->_can_overload($_[0], "\"\"") and index("$_[0]", "\n") == -1
scalar(@_) % 2 and !ref($_[0]) || $self->_can_overload($_[0], "\"\"")
not ref $_[0] or $self->_can_overload($_[0], "\"\"")
MC/DC25%1/4
scalar(@_) % 2 and !ref($_[0]) || $self->_can_overload($_[0], "\"\"") and index("$_[0]", "\n") == -1
scalar(@_) % 2
not ref $_[0]
$self->_can_overload($_[0], "\"\"")
index("$_[0]", "\n") == -1
Truth table33%2/6
A and not(B) or C and D
A= scalar(@_) % 2B= not ref $_[0]C= $self->_can_overload($_[0], "\"\"")D= index("$_[0]", "\n") == -1
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | ( !ref( $_[0] ) || $self->_can_overload( $_[0] => '""' ) ) && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | index( "$_[0]", "\n" ) == -1 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # shift() first to avoid $_[0] being altered by new_file() resolution | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 4 | my $f = $self->new_file( shift( @_ ) ); # Module::Generic::File will trigger stringification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 4 | ▶ | if( $f->exists ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | # then, we pass it back here: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 4 | unshift( @_, path => $f ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 11 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 11 | ▶ | unless( defined( $opts->{data} ) || defined( $opts->{path} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $opts->{"data"} or defined $opts->{"path"}
MC/DC50%1/2
defined $opts->{"data"} or defined $opts->{"path"}
defined $opts->{"data"}
defined $opts->{"path"}
Truth table66%2/3
A or B
A= defined $opts->{"data"}B= defined $opts->{"path"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | return( $self->error( "attach(): 'data' or 'path' is required." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 10 | ▶ | $opts->{disposition} //= 'attachment'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts->{"disposition"} //= "attachment"
MC/DC0%0/1
$opts->{"disposition"} //= "attachment"
$opts->{"disposition"}
Truth table50%1/2
A
A= $opts->{"disposition"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 10 | ▶ | my $entity = Mail::Make::Entity->build( %$opts ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'Mail::Make::Entity'->build(%$opts) || (return $self->pass_error('Mail::Make::Entity'->error))
MC/DC0%0/1
'Mail::Make::Entity'->build(%$opts) || (return $self->pass_error('Mail::Make::Entity'->error))
'Mail::Make::Entity'->build(%$opts)
Truth table50%1/2
A
A= 'Mail::Make::Entity'->build(%$opts)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | return( $self->pass_error( Mail::Make::Entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 10 | push( @{$self->{_parts}}, $entity ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 10 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | # attach_inline( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | # Adds an inline part (e.g. an image referenced via cid: in HTML). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | # 'id' or 'cid' is required. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | sub attach_inline | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 7 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attach_inline: called CC=8 SCAR=21.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 7 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 7 | ▶ | unless( defined( $opts->{data} ) || defined( $opts->{path} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $opts->{"data"} or defined $opts->{"path"}
MC/DC0%0/2
defined $opts->{"data"} or defined $opts->{"path"}
defined $opts->{"data"}
defined $opts->{"path"}
Truth table33%1/3
A or B
A= defined $opts->{"data"}B= defined $opts->{"path"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | return( $self->error( "attach_inline(): 'data' or 'path' is required." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 7 | ▶ | unless( defined( $opts->{id} ) || defined( $opts->{cid} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $opts->{"id"} or defined $opts->{"cid"}
MC/DC100%2/2
defined $opts->{"id"} or defined $opts->{"cid"}
defined $opts->{"id"}
defined $opts->{"cid"}
Truth table100%3/3
A or B
A= defined $opts->{"id"}B= defined $opts->{"cid"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | return( $self->error( "attach_inline(): 'id' or 'cid' is required for inline parts." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # Normalise: Entity->build() expects 'cid' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 6 | ▶ | $opts->{cid} //= delete( $opts->{id} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opts->{"cid"} //= delete $opts->{"id"}
MC/DC0%0/2
$opts->{"cid"} //= delete $opts->{"id"}
$opts->{"cid"}
delete $opts->{"id"}
Truth table66%2/3
A //= B
A= $opts->{"cid"}B= delete $opts->{"id"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 6 | ▶ | $opts->{disposition} //= 'inline'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts->{"disposition"} //= "inline"
MC/DC0%0/1
$opts->{"disposition"} //= "inline"
$opts->{"disposition"}
Truth table50%1/2
A
A= $opts->{"disposition"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 6 | ▶ | my $entity = Mail::Make::Entity->build( %$opts ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'Mail::Make::Entity'->build(%$opts) || (return $self->pass_error('Mail::Make::Entity'->error))
MC/DC0%0/1
'Mail::Make::Entity'->build(%$opts) || (return $self->pass_error('Mail::Make::Entity'->error))
'Mail::Make::Entity'->build(%$opts)
Truth table50%1/2
A
A= 'Mail::Make::Entity'->build(%$opts)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | return( $self->pass_error( Mail::Make::Entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 6 | push( @{$self->{_parts}}, $entity ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 6 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # bcc( @addresses ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # Accumulates BCC recipients (may be called multiple times). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | sub bcc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bcc: called CC=4 SCAR=15.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 2 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 2 | ▶ | my @encoded = map { $self->_encode_address( $_ ) } ( ref( $_[0] ) eq 'ARRAY' ? @{$_[0]} : @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | $self->{_headers}->push_header( 'Bcc' => join( ', ', @encoded ) ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 2 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 2 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | return( $self->{_headers}->header( 'Bcc' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # build( %params ) - alternate hash-based constructor/factory | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # Returns a Mail::Make object with all parameters applied. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | sub build | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 8 | ▶ | my $class = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: called CC=33 SCAR=44.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 8 | my $params = $class->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 8 | ▶ | my $self = $class->new || return( $class->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$class->new || (return $class->pass_error)
MC/DC0%0/1
$class->new || (return $class->pass_error)
$class->new
Truth table50%1/2
A
A= $class->new
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # Scalar envelope fields | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 8 | foreach my $field ( qw( date from in_reply_to message_id reply_to return_path sender subject ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | $self->$field( $params->{ $field } ) || return( $self->pass_error ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 64 | ▶ | if( exists( $params->{ $field } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
exists $params->{$field} && ($self->$field($params->{$field}) || (return $self->pass_error))
$self->$field($params->{$field}) or return $self->pass_error
MC/DC0%0/2
exists $params->{$field} && ($self->$field($params->{$field}) || (return $self->pass_error))
exists $params->{$field}
$self->$field($params->{$field})
Truth table33%1/3
A && B
A= exists $params->{$field}B= $self->$field($params->{$field})
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # List fields | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 8 | foreach my $field ( qw( bcc cc references to ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 32 | ▶ | if( exists( $params->{ $field } ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 8 | my $v = $params->{ $field }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 8 | ▶ | $self->$field( ref( $v ) eq 'ARRAY' ? @$v : $v ) || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # Body convenience shorthands | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 8 | ▶ | if( exists( $params->{plain} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 8 | ▶ | if( exists( $params->{plain_opts} ) && ref( $params->{plain_opts} ) ne 'HASH' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $params->{"plain_opts"} and ref $params->{"plain_opts"} ne "HASH"
MC/DC0%0/2
exists $params->{"plain_opts"} and ref $params->{"plain_opts"} ne "HASH"
exists $params->{"plain_opts"}
ref $params->{"plain_opts"} ne "HASH"
Truth table33%1/3
A and B
A= exists $params->{"plain_opts"}B= ref $params->{"plain_opts"} ne "HASH"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | return( $self->error( "The parameter 'plain_opts' must be a hash reference. You provided '", $self->_str_val( $params->{plain_opts} // 'undef' ), "'." ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$params->{"plain_opts"} // "undef"
MC/DC0%0/1
$params->{"plain_opts"} // "undef"
$params->{"plain_opts"}
Truth table0%0/2
A
A= $params->{"plain_opts"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 8 | ▶ | my %opts = %{$params->{plain_opts} // {}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$params->{"plain_opts"} // {}
MC/DC0%0/1
$params->{"plain_opts"} // {}
$params->{"plain_opts"}
Truth table50%1/2
A
A= $params->{"plain_opts"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 8 | ▶ | $self->plain( $params->{plain}, %opts ) || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 8 | ▶ | if( exists( $params->{html} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | if( exists( $params->{html_opts} ) && ref( $params->{html_opts} ) ne 'HASH' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $params->{"html_opts"} and ref $params->{"html_opts"} ne "HASH"
MC/DC0%0/2
exists $params->{"html_opts"} and ref $params->{"html_opts"} ne "HASH"
exists $params->{"html_opts"}
ref $params->{"html_opts"} ne "HASH"
Truth table0%0/3
A and B
A= exists $params->{"html_opts"}B= ref $params->{"html_opts"} ne "HASH"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | return( $self->error( "The parameter 'html_opts' must be a hash reference. You provided '", $self->_str_val( $params->{html_opts} // 'undef' ), "'." ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$params->{"html_opts"} // "undef"
MC/DC0%0/1
$params->{"html_opts"} // "undef"
$params->{"html_opts"}
Truth table0%0/2
A
A= $params->{"html_opts"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | my %opts = %{$params->{html_opts} // {}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$params->{"html_opts"} // {}
MC/DC0%0/1
$params->{"html_opts"} // {}
$params->{"html_opts"}
Truth table0%0/2
A
A= $params->{"html_opts"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | $self->html( $params->{html}, %opts ) || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # Attachments: scalar, arrayref of scalars, or arrayref of hashrefs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 8 | ▶ | if( exists( $params->{attach} ) && defined( $params->{attach} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $params->{"attach"} and defined $params->{"attach"}
MC/DC50%1/2
exists $params->{"attach"} and defined $params->{"attach"}
exists $params->{"attach"}
defined $params->{"attach"}
Truth table66%2/3
A and B
A= exists $params->{"attach"}B= defined $params->{"attach"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 4 | my $attach = $params->{attach}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # Accepts vanilla array reference or array objects like Module::Generic::Array | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 4 | ▶ | my @items = $self->_is_array( $attach ) ? @$attach : ( $attach ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 4 | foreach my $item ( @items ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 7 | ▶ | next unless( defined( $item ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | # Such as: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # { path => '/some/where/file.pdf', filename => '04 report.pdf', type => 'application/pdf' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | # { data => $attachment_data, filename => '04 report.pdf', type => 'application/pdf' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 7 | ▶ | if( ref( $item ) eq 'HASH' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 3 | ▶ | $self->attach( %$item ) || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | # Plain scalar or stringifiable object - delegate to attach() which | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | # already handles the positional shorthand | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # So, this can be an attachment data, or a file path, or a file object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # like Module::Generic::File (as long as it stringifies) and does not | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # contain a "\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 4 | ▶ | $self->attach( $item ) || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | # Extra arbitrary headers | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 8 | ▶ | if( exists( $params->{headers} ) && ref( $params->{headers} ) eq 'HASH' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $params->{"headers"} and ref $params->{"headers"} eq "HASH"
MC/DC50%1/2
exists $params->{"headers"} and ref $params->{"headers"} eq "HASH"
exists $params->{"headers"}
ref $params->{"headers"} eq "HASH"
Truth table66%2/3
A and B
A= exists $params->{"headers"}B= ref $params->{"headers"} eq "HASH"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 1 | ▶ | while( my( $n, $v ) = each( %{$params->{headers}} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1 | ▶ | $self->header( $n, $v ) || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 8 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | # cc( @addresses ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # Accumulates CC recipients. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | sub cc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 3 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cc: called CC=4 SCAR=15.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 3 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 3 | ▶ | my @encoded = map { $self->_encode_address( $_ ) } ( ref( $_[0] ) eq 'ARRAY' ? @{$_[0]} : @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | $self->{_headers}->push_header( 'Cc' => join( ', ', @encoded ) ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 3 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 3 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | return( $self->{_headers}->header( 'Cc' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # date( [$date_string_or_epoch] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # Delegates to Mail::Make::Headers::date(), which handles epoch integers, string validation, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | # and RFC 5322 formatting. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | sub date | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
date: not called CC=3 SCAR=24.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | $self->{_headers}->date( @_ ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | return( $self->{_headers}->date ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # from( [$address] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | sub from | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 47 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from: called CC=3 SCAR=11.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 47 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 47 | my $addr = $self->_encode_address( shift( @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | $self->{_headers}->set( 'From' => $addr ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 47 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 47 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | return( $self->{_headers}->header( 'From' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | # header( $name, $value ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # Appends an arbitrary extra header to the envelope (push_header semantics: does not | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # replace, allows multiple values for the same field). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | sub header | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 2 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header: called CC=6 SCAR=22.3
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 2 | ▶ | if( @_ == 1 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | # Getter shortcut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return( $self->{_headers}->header( $_[0] ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 2 | my( $name, $value ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 2 | ▶ | unless( defined( $name ) && length( $name ) && defined( $value ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $name and length $name and defined $value
defined $name and length $name
MC/DC0%0/3
defined $name and length $name and defined $value
defined $name
length $name
defined $value
Truth table25%1/4
A and B and C
A= defined $nameB= length $nameC= defined $value
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | return( $self->error( "header(): name and value are required." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | $self->{_headers}->push_header( $name => $value ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 2 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 2 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # headers() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | # Returns the Mail::Make::Headers object that holds the envelope headers. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # Read-only: the object is created in init() and is not replaceable from outside, to | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # prevent accidental aliasing. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | sub headers { return( $_[0]->{_headers} ); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
headers: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | # html( $content [, %opts] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | # Adds a text/html body part. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | sub html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 9 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
html: called CC=5 SCAR=17.3
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 9 | my $text = shift( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 9 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 9 | ▶ | unless( defined( $text ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | return( $self->error( "html(): text content is required." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | my $part = Mail::Make::Entity->build( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | type => 'text/html', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | charset => ( $opts->{charset} // 'utf-8' ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 9 | ▶ | encoding => ( $opts->{encoding} // 'quoted-printable' ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
'Mail::Make::Entity'->build('type', 'text/html', 'charset', $opts->{'charset'} // 'utf-8', 'encoding', $opts->{'encoding'} // 'quoted-printable', 'data', $text) || (return $self->pass_error('Mail::Make::Entity'->error))
$opts->{"charset"} // "utf-8"
$opts->{"encoding"} // "quoted-printable"
MC/DC0%0/1
'Mail::Make::Entity'->build('type', 'text/html', 'charset', $opts->{'charset'} // 'utf-8', 'encoding', $opts->{'encoding'} // 'quoted-printable', 'data', $text) || (return $self->pass_error('Mail::Make::Entity'->error))
'Mail::Make::Entity'->build('type', 'text/html', 'charset', $opts->{'charset'} // 'utf-8', 'encoding', $opts->{'encoding'} // 'quoted-printable', 'data', $text)
MC/DC0%0/1
$opts->{"charset"} // "utf-8"
$opts->{"charset"}
MC/DC0%0/1
$opts->{"encoding"} // "quoted-printable"
$opts->{"encoding"}
Truth table50%1/2
A
A= 'Mail::Make::Entity'->build('type', 'text/html', 'charset', $opts->{'charset'} // 'utf-8', 'encoding', $opts->{'encoding'} // 'quoted-printable', 'data', $text)
Truth table50%1/2
A
A= $opts->{"charset"}
Truth table50%1/2
A
A= $opts->{"encoding"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | data => $text, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | ) || return( $self->pass_error( Mail::Make::Entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 9 | push( @{$self->{_parts}}, $part ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 9 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # in_reply_to( [$mid] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | sub in_reply_to | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
in_reply_to: not called CC=3 SCAR=24.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | $self->{_headers}->set( 'In-Reply-To' => shift( @_ ) ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | return( $self->{_headers}->header( 'In-Reply-To' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # max_body_in_memory_size( [$bytes] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | # Gets or sets the byte threshold above which as_string_ref() spools to a temporary file. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # Set to 0 to disable the threshold (always use memory). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # Default: $Mail::Make::MAX_BODY_IN_MEMORY_SIZE (1 MiB). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | sub max_body_in_memory_size { return( shift->_set_get_number( 'max_body_in_memory_size', @_ ) ); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_body_in_memory_size: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # message_id( [$mid | \%opts] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | # Delegates fully to Mail::Make::Headers::message_id(), which handles generation, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | # validation, and removal. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | sub message_id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
message_id: not called CC=3 SCAR=24.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | $self->{_headers}->message_id( @_ ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | return( $self->{_headers}->message_id ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | # plain( $content [, %opts] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | # Adds a text/plain body part. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | sub plain | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 43 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plain: called CC=5 SCAR=17.3
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 43 | my $text = shift( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 43 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 43 | ▶ | unless( defined( $text ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | return( $self->error( "plain(): text content is required." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | my $part = Mail::Make::Entity->build( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | type => 'text/plain', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | charset => ( $opts->{charset} // 'utf-8' ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 43 | ▶ | encoding => ( $opts->{encoding} // 'quoted-printable' ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
'Mail::Make::Entity'->build('type', 'text/plain', 'charset', $opts->{'charset'} // 'utf-8', 'encoding', $opts->{'encoding'} // 'quoted-printable', 'data', $text) || (return $self->pass_error('Mail::Make::Entity'->error))
$opts->{"charset"} // "utf-8"
$opts->{"encoding"} // "quoted-printable"
MC/DC0%0/1
'Mail::Make::Entity'->build('type', 'text/plain', 'charset', $opts->{'charset'} // 'utf-8', 'encoding', $opts->{'encoding'} // 'quoted-printable', 'data', $text) || (return $self->pass_error('Mail::Make::Entity'->error))
'Mail::Make::Entity'->build('type', 'text/plain', 'charset', $opts->{'charset'} // 'utf-8', 'encoding', $opts->{'encoding'} // 'quoted-printable', 'data', $text)
MC/DC0%0/1
$opts->{"charset"} // "utf-8"
$opts->{"charset"}
MC/DC0%0/1
$opts->{"encoding"} // "quoted-printable"
$opts->{"encoding"}
Truth table50%1/2
A
A= 'Mail::Make::Entity'->build('type', 'text/plain', 'charset', $opts->{'charset'} // 'utf-8', 'encoding', $opts->{'encoding'} // 'quoted-printable', 'data', $text)
Truth table50%1/2
A
A= $opts->{"charset"}
Truth table50%1/2
A
A= $opts->{"encoding"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | data => $text, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | ) || return( $self->pass_error( Mail::Make::Entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 43 | push( @{$self->{_parts}}, $part ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 43 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | # print( $fh ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | # Serialises the assembled message to a filehandle. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | sub print | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: not called CC=6 SCAR=37.4
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | ▶ | my $fh = shift( @_ ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @_ || (return $self->error('No file handle was provided to print the mail entity.'))
MC/DC0%0/1
shift @_ || (return $self->error('No file handle was provided to print the mail entity.'))
shift @_
Truth table0%0/2
A
A= shift @_
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | return( $self->error( "No file handle was provided to print the mail entity." ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | unless( $self->_is_glob( $fh ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | return( $self->error( "Value provided (", $self->_str_val( $fh // 'undef' ), ") is not a file handle." ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$fh // "undef"
MC/DC0%0/1
$fh // "undef"
$fh
Truth table0%0/2
A
A= $fh
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | my $entity = $self->as_entity || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->as_entity || (return $self->pass_error)
MC/DC0%0/1
$self->as_entity || (return $self->pass_error)
$self->as_entity
Truth table0%0/2
A
A= $self->as_entity
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | $entity->print( $fh ) || return( $self->pass_error( $entity->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # references( @mids ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # Accumulates Message-ID references. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | sub references | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
references: not called CC=5 SCAR=34.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | my @mids = ( ref( $_[0] ) eq 'ARRAY' ? @{$_[0]} : @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # References is a single folded header: accumulate by appending. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | my $existing = $self->{_headers}->header( 'References' ) // ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"_headers"}->header("References") // ""
MC/DC0%0/1
$self->{"_headers"}->header("References") // ""
$self->{"_headers"}->header("References")
Truth table0%0/2
A
A= $self->{"_headers"}->header("References")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my $new = join( ' ', grep{ length( $_ ) } $existing, @mids ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | $self->{_headers}->set( 'References' => $new ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | return( $self->{_headers}->header( 'References' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | # reply_to( [$address] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | sub reply_to | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 1 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reply_to: called CC=3 SCAR=11.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 1 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 1 | my $addr = $self->_encode_address( shift( @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | $self->{_headers}->set( 'Reply-To' => $addr ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 1 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | return( $self->{_headers}->header( 'Reply-To' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | # return_path( [$address] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | sub return_path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
return_path: not called CC=3 SCAR=24.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | my $addr = $self->_encode_address( shift( @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | $self->{_headers}->set( 'Return-Path' => $addr ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | return( $self->{_headers}->header( 'Return-Path' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | # sender( [$address] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | sub sender | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 1 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sender: called CC=3 SCAR=11.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 1 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 1 | my $addr = $self->_encode_address( shift( @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | $self->{_headers}->set( 'Sender' => $addr ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | return( $self->{_headers}->header( 'Sender' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | # smtpsend( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | # Assembles the message and submits it via SMTP using Net::SMTP. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | # Recognised options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | # Host => $hostname_or_Net_SMTP_object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | # Defaults to trying $ENV{SMTPHOSTS} (colon-separated), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | # 'mailhost', then 'localhost'. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | # MailFrom => $envelope_sender (MAIL FROM) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | # Defaults to the From: header address-spec. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | # To => \@recipients Override the To header for RCPT TO. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | # Cc => \@recipients Additional CC addresses for RCPT TO. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | # Bcc => \@recipients Additional BCC addresses for RCPT TO. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | # Note: Bcc is stripped from the outgoing headers per RFC 2822 §3.6.3. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | # Hello => $fqdn EHLO/HELO hostname. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | # Port => $port SMTP port (default 25). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | # Debug => $bool Enable Net::SMTP debug output. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | # Returns the list of recipients successfully handed to the MTA on success, or undef and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | # sets error() on failure. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | sub smtpsend | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 12 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
smtpsend: called CC=63 SCAR=57.1
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 12 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 12 | ▶ | $self->_load_class( 'Net::SMTP' ) || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | # Build the entity first so we can inspect its headers | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 12 | ▶ | my $entity = $self->as_entity || return( $self->pass_error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->as_entity || (return $self->pass_error)
MC/DC0%0/1
$self->as_entity || (return $self->pass_error)
$self->as_entity
Truth table50%1/2
A
A= $self->as_entity
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | # Determine envelope sender (MAIL FROM) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 12 | my $mail_from = $opts->{MailFrom}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 12 | ▶ | unless( defined( $mail_from ) && length( $mail_from ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $mail_from and length $mail_from
MC/DC50%1/2
defined $mail_from and length $mail_from
defined $mail_from
length $mail_from
Truth table66%2/3
A and B
A= defined $mail_fromB= length $mail_from
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 11 | ▶ | my $from_hdr = $self->{_headers}->header( 'From' ) // ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_headers"}->header("From") // ""
MC/DC0%0/1
$self->{"_headers"}->header("From") // ""
$self->{"_headers"}->header("From")
Truth table50%1/2
A
A= $self->{"_headers"}->header("From")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 11 | ▶ | if( $from_hdr =~ /<([^>]+)>/ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 1 | $mail_from = $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 10 | ( $mail_from = $from_hdr ) =~ s/\s+//g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 12 | ▶ | unless( defined( $mail_from ) && length( $mail_from ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $mail_from and length $mail_from
MC/DC0%0/2
defined $mail_from and length $mail_from
defined $mail_from
length $mail_from
Truth table33%1/3
A and B
A= defined $mail_fromB= length $mail_from
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | return( $self->error( "smtpsend(): cannot determine envelope sender (MAIL FROM). Set MailFrom or From header." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | # Validate auth credentials before touching the network | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | # Password may be a plain string or a CODE ref (resolved later). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 12 | my $username = $opts->{Username}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 12 | my $password = $opts->{Password}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 12 | ▶ | if( defined( $username ) && length( $username ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $username and length $username
MC/DC50%1/2
defined $username and length $username
defined $username
length $username
Truth table66%2/3
A and B
A= defined $usernameB= length $username
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 2 | ▶ | unless( defined( $password ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 1 | return( $self->error( "smtpsend(): Username supplied but Password is missing." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | # Authen::SASL and MIME::Base64 are required for SMTP AUTH. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | # Check early so the error is clear rather than a cryptic auth failure. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 1 | foreach my $mod ( qw( MIME::Base64 Authen::SASL ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 2 | ▶ | $self->_load_class( $mod ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | return( $self->error( "smtpsend(): SMTP authentication requires $mod, which is not installed. Install it with: cpan $mod" ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | # Determine RCPT TO addresses before connecting, so we can bail early. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | # Honour explicit override lists first; fall back to message headers. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 11 | my @rcpt_raw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 11 | foreach my $field ( qw( To Cc Bcc ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 33 | my $v = $opts->{ $field }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 33 | ▶ | if( defined( $v ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 1 | ▶ | push( @rcpt_raw, ref( $v ) eq 'ARRAY' ? @$v : $v ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 32 | ▶ | my $hv = $self->{_headers}->header( $field ) // ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"_headers"}->header($field) // ""
MC/DC100%1/1
$self->{"_headers"}->header($field) // ""
$self->{"_headers"}->header($field)
Truth table100%2/2
A
A= $self->{"_headers"}->header($field)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 32 | ▶ | push( @rcpt_raw, $hv ) if( length( $hv ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | # Parse each raw value into bare addr-specs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 11 | my @addr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 11 | foreach my $raw ( @rcpt_raw ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 14 | my @found_angle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 14 | ▶ | while( $raw =~ /<([^>]+)>/g ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | push( @found_angle, $1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 14 | ▶ | if( @found_angle ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | push( @addr, @found_angle ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | # Bare comma-separated list (no angle brackets) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 14 | push( @addr, grep{ /\@/ } map{ s/^\s+|\s+$//gr } split( /,/, $raw ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | # Deduplicate while preserving order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 11 | my %seen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 11 | @addr = grep{ !$seen{ $_ }++ } @addr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 11 | ▶ | unless( @addr ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 1 | return( $self->error( "smtpsend(): no recipients found." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | # Build Net::SMTP connection options | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | # SSL => 1 : direct SSL/TLS (e.g. port 465, aka SMTPS) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 10 | my @smtp_opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 10 | ▶ | push( @smtp_opts, Hello => $opts->{Hello} ) if( defined( $opts->{Hello} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 10 | ▶ | push( @smtp_opts, Port => $opts->{Port} ) if( defined( $opts->{Port} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 10 | ▶ | push( @smtp_opts, Debug => $opts->{Debug} ) if( defined( $opts->{Debug} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 10 | ▶ | push( @smtp_opts, Timeout => $opts->{Timeout} ) if( defined( $opts->{Timeout} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 10 | ▶ | if( $opts->{SSL} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | push( @smtp_opts, SSL => 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | ▶ | if( ref( $opts->{SSL_opts} ) eq 'HASH' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | push( @smtp_opts, %{$opts->{SSL_opts}} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | # NOTE: SMTP connect | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 10 | my $smtp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 10 | my $quit = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 10 | my $host = $opts->{Host}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 10 | ▶ | if( !defined( $host ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | my @hosts = qw( mailhost localhost ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | ▶ | if( defined( $ENV{SMTPHOSTS} ) && length( $ENV{SMTPHOSTS} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ENV{"SMTPHOSTS"} and length $ENV{"SMTPHOSTS"}
MC/DC0%0/2
defined $ENV{"SMTPHOSTS"} and length $ENV{"SMTPHOSTS"}
defined $ENV{"SMTPHOSTS"}
length $ENV{"SMTPHOSTS"}
Truth table0%0/3
A and B
A= defined $ENV{"SMTPHOSTS"}B= length $ENV{"SMTPHOSTS"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | unshift( @hosts, split( /:/, $ENV{SMTPHOSTS} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | foreach my $h ( @hosts ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | local $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $smtp = eval{ Net::SMTP->new( $h, @smtp_opts ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | last if( defined( $smtp ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | elsif( $self->_is_a( $host => 'Net::SMTP' ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | # Caller passes an already-connected object; we must not quit it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 1 | $smtp = $host; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 1 | $quit = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 9 | local $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 9 | $smtp = eval{ Net::SMTP->new( $host, @smtp_opts ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 10 | ▶ | unless( defined( $smtp ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 1 | return( $self->error( "smtpsend(): could not connect to any SMTP server." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | # STARTTLS upgrade (ignored when caller supplied a pre-built object or SSL) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 9 | ▶ | if( $opts->{StartTLS} && $quit ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opts->{"StartTLS"} and $quit
MC/DC0%0/2
$opts->{"StartTLS"} and $quit
$opts->{"StartTLS"}
$quit
Truth table33%1/3
A and B
A= $opts->{"StartTLS"}B= $quit
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | my %tls_opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | ▶ | if( ref( $opts->{SSL_opts} ) eq 'HASH' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | %tls_opts = %{$opts->{SSL_opts}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | unless( $smtp->starttls( %tls_opts ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | my $smtp_msg = join( ' ', $smtp->message ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | $smtp->quit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | ▶ | return( $self->error( "smtpsend(): STARTTLS negotiation failed" . ( length( $smtp_msg ) ? ": $smtp_msg" : '.' ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | # ------------------------------------------------------------------------- | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | # SMTP Authentication (SASL via Authen::SASL + Net::SMTP::auth) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | # Password is resolved here so the CODE ref is called as late as possible. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | # We build an explicit Authen::SASL object rather than letting Net::SMTP | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | # pick the mechanism freely. Left to itself, Authen::SASL prefers | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | # DIGEST-MD5 and CRAM-MD5, which are both deprecated (RFC 6331, RFC 8314) and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | # routinely disabled on modern Postfix/Dovecot servers. Over an already | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | # encrypted STARTTLS or SSL channel, PLAIN and LOGIN are both safe and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | # universally supported. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | # Mechanism selection: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # 1. Caller may supply an explicit list via AuthMechanisms option. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # 2. Otherwise we use our preferred order: PLAIN LOGIN. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | # 3. We intersect with what the server actually advertises (supports AUTH). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | # ------------------------------------------------------------------------- | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 9 | ▶ | if( defined( $username ) && length( $username ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $username and length $username
MC/DC50%1/2
defined $username and length $username
defined $username
length $username
Truth table66%2/3
A and B
A= defined $usernameB= length $username
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 1 | ▶ | if( ref( $password ) eq 'CODE' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 1 | local $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 1 | $password = eval{ $password->() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 1 | ▶ | if( $@ || !defined( $password ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$@ or not defined $password
MC/DC0%0/2
$@ or not defined $password
$@
not defined $password
Truth table33%1/3
A or not(B)
A= $@B= not defined $password
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | $smtp->quit if( $quit ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | return( $self->error( "smtpsend(): password callback failed: " . ( $@ // 'returned undef' ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$@ // "returned undef"
MC/DC0%0/1
$@ // "returned undef"
$@
Truth table0%0/2
A
A= $@
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | # Determine which mechanisms the server advertises | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 1 | ▶ | my $server_mechs = $smtp->supports( 'AUTH' ) // ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$smtp->supports("AUTH") // ""
MC/DC0%0/1
$smtp->supports("AUTH") // ""
$smtp->supports("AUTH")
Truth table50%1/2
A
A= $smtp->supports("AUTH")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | # Build the preferred mechanism list | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 1 | ▶ | my $preferred = $opts->{AuthMechanisms} // 'PLAIN LOGIN'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts->{"AuthMechanisms"} // "PLAIN LOGIN"
MC/DC0%0/1
$opts->{"AuthMechanisms"} // "PLAIN LOGIN"
$opts->{"AuthMechanisms"}
Truth table50%1/2
A
A= $opts->{"AuthMechanisms"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | # Intersect: keep only those the server supports, preserving our order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 1 | my %server_set = map{ uc( $_ ) => 1 } split( /\s+/, $server_mechs ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 1 | my @agreed = grep{ $server_set{ uc( $_ ) } } split( /\s+/, $preferred ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 1 | ▶ | if( !@agreed ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | # No intersection -- fall back to whatever the server offers, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | # excluding the deprecated challenge-response mechanisms. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | @agreed = grep{ !/^(?:DIGEST-MD5|CRAM-MD5|GSSAPI)$/i } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | split( /\s+/, $server_mechs ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 1 | my $sasl = Authen::SASL->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | mechanism => join( ' ', @agreed ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | callback => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | user => $username, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | pass => $password, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | authname => $username, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 1 | ▶ | unless( $smtp->auth( $sasl ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | # Capture the server's error message for a more useful diagnostic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 1 | my $smtp_msg = join( ' ', $smtp->message ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 1 | ▶ | $smtp->quit if( $quit ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 1 | ▶ | return( $self->error( "smtpsend(): SMTP authentication failed for user '$username'" . ( length( $smtp_msg ) ? ": $smtp_msg" : '.' ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | # Serialise message, stripping Bcc from transmitted copy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | my $send_entity = $self->as_entity || do | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 8 | ▶ | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->as_entity || do {
$smtp->quit if $quit;
return $self->pass_error
}
MC/DC0%0/2
$self->as_entity || do {
$smtp->quit if $quit;
return $self->pass_error
}
$self->as_entity
do {
$smtp->quit if $quit;
return $self->pass_error
}
Truth table33%1/3
A || B
A= $self->as_entityB= do {
$smtp->quit if $quit;
return $self->pass_error
}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | $smtp->quit if( $quit ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 8 | $send_entity->headers->remove( 'Bcc' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | my $msg = $send_entity->as_string || do | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 8 | ▶ | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$send_entity->as_string || do {
$smtp->quit if $quit;
return $self->pass_error($send_entity->error)
}
MC/DC0%0/2
$send_entity->as_string || do {
$smtp->quit if $quit;
return $self->pass_error($send_entity->error)
}
$send_entity->as_string
do {
$smtp->quit if $quit;
return $self->pass_error($send_entity->error)
}
Truth table33%1/3
A || B
A= $send_entity->as_stringB= do {
$smtp->quit if $quit;
return $self->pass_error($send_entity->error)
}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | ▶ | $smtp->quit if( $quit ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | return( $self->pass_error( $send_entity->error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | # Submit | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 8 | ▶ | my $ok = $smtp->mail( $mail_from ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$smtp->mail($mail_from) && $smtp->to(@addr) && $smtp->data($msg)
$smtp->mail($mail_from) and $smtp->to(@addr)
MC/DC0%0/3
$smtp->mail($mail_from) && $smtp->to(@addr) && $smtp->data($msg)
$smtp->mail($mail_from)
$smtp->to(@addr)
$smtp->data($msg)
Truth table25%1/4
A and B && C
A= $smtp->mail($mail_from)B= $smtp->to(@addr)C= $smtp->data($msg)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | && $smtp->to( @addr ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | && $smtp->data( $msg ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 8 | ▶ | $smtp->quit if( $quit ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 8 | ▶ | unless( $ok ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | return( $self->error( "smtpsend(): SMTP transaction failed." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 8 | ▶ | return( wantarray() ? @addr : \@addr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | # subject( [$string] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | # RFC 2047-encodes non-ASCII subjects before storing. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | sub subject | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 39 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subject: called CC=3 SCAR=11.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 39 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 39 | my $enc = $self->_encode_header( shift( @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | $self->{_headers}->set( 'Subject' => $enc ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 39 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 39 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | return( $self->{_headers}->header( 'Subject' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | # to( @addresses ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | # Accumulates To recipients. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | sub to | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 48 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to: called CC=5 SCAR=17.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 48 | ▶ | if( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 48 | ▶ | my @encoded = map{ $self->_encode_address( $_ ) } ( ref( $_[0] ) eq 'ARRAY' ? @{$_[0]} : @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | # Merge into a single To: header (RFC 5322 §3.6.3 allows only one To field) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 48 | my $existing = $self->{_headers}->header( 'To' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 48 | ▶ | my $new_val = join( ', ', grep{ defined( $_ ) && length( $_ ) } $existing, @encoded ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | $self->{_headers}->set( 'To' => $new_val ) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 48 | ▶ | return( $self->pass_error( $self->{_headers}->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 48 | return( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | return( $self->{_headers}->header( 'To' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | # use_temp_file( [$bool] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | # When true, as_string_ref() always spools to a temporary file regardless of message size. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | # This is used when we know the message will be large, or when we want to bound peak | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | # memory use unconditionally. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | # Default: false. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | sub use_temp_file { return( shift->_set_get_boolean( 'use_temp_file', @_ ) ); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
use_temp_file: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | # gpg_encrypt( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | # Encrypts this message for one or more recipients and returns a new Mail::Make object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | # whose body is a RFC 3156 multipart/encrypted structure. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | # Required options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | # Recipients => [ 'alice@example.com', ... ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | # Optional options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | # GpgBin => '/usr/bin/gpg2' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | # KeyServer => 'keys.openpgp.org' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | # AutoFetch => 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | # Digest => 'SHA256' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | sub gpg_encrypt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gpg_encrypt: not called CC=9 SCAR=45.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | require Mail::Make::GPG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | my $gpg = Mail::Make::GPG->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | ( defined( $opts->{GpgBin} ) ? ( gpg_bin => $opts->{GpgBin} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | ( defined( $opts->{Digest} ) ? ( digest => $opts->{Digest} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | ( defined( $opts->{KeyServer} ) ? ( keyserver => $opts->{KeyServer} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | ▶ | ( defined( $opts->{AutoFetch} ) ? ( auto_fetch => $opts->{AutoFetch} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/2
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : (), defined $opts->{'KeyServer'} ? ('keyserver', $opts->{'KeyServer'}) : (), defined $opts->{'AutoFetch'} ? ('auto_fetch', $opts->{'AutoFetch'}) : ()) || (return $self->pass_error('Mail::Make::GPG'->error))
MC/DC0%0/1
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : (), defined $opts->{'KeyServer'} ? ('keyserver', $opts->{'KeyServer'}) : (), defined $opts->{'AutoFetch'} ? ('auto_fetch', $opts->{'AutoFetch'}) : ()) || (return $self->pass_error('Mail::Make::GPG'->error))
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : (), defined $opts->{'KeyServer'} ? ('keyserver', $opts->{'KeyServer'}) : (), defined $opts->{'AutoFetch'} ? ('auto_fetch', $opts->{'AutoFetch'}) : ())
Truth table0%0/2
A
A= 'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : (), defined $opts->{'KeyServer'} ? ('keyserver', $opts->{'KeyServer'}) : (), defined $opts->{'AutoFetch'} ? ('auto_fetch', $opts->{'AutoFetch'}) : ())
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | ) || return( $self->pass_error( Mail::Make::GPG->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | my $recipients = $opts->{Recipients} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | ▶ | return( $self->error( 'gpg_encrypt(): Recipients option is required.' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{'Recipients'} || (return $self->error('gpg_encrypt(): Recipients option is required.'))
MC/DC0%0/1
$opts->{'Recipients'} || (return $self->error('gpg_encrypt(): Recipients option is required.'))
$opts->{'Recipients'}
Truth table0%0/2
A
A= $opts->{'Recipients'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | ▶ | $recipients = [ $recipients ] unless( ref( $recipients ) eq 'ARRAY' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | ▶ | return( $gpg->encrypt( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$gpg->encrypt('entity', $self, 'recipients', $recipients) || $self->pass_error($gpg->error)
MC/DC0%0/2
$gpg->encrypt('entity', $self, 'recipients', $recipients) || $self->pass_error($gpg->error)
$gpg->encrypt('entity', $self, 'recipients', $recipients)
$self->pass_error($gpg->error)
Truth table0%0/3
A || B
A= $gpg->encrypt('entity', $self, 'recipients', $recipients)B= $self->pass_error($gpg->error)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | entity => $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | recipients => $recipients, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | ) || $self->pass_error( $gpg->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | # gpg_sign( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | # Signs this message and returns a new Mail::Make object whose body is a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | # RFC 3156 multipart/signed structure with a detached ASCII-armoured signature. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | # Required options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | # KeyId => '35ADBC3AF8355E845139D8965F3C0261CDB2E752' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | # Optional options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | # Passphrase => 'secret' # or CODE ref; omit to use gpg-agent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | # Digest => 'SHA256' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | # GpgBin => '/usr/bin/gpg2' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | sub gpg_sign | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gpg_sign: not called CC=8 SCAR=42.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | require Mail::Make::GPG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | my $gpg = Mail::Make::GPG->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | ( defined( $opts->{GpgBin} ) ? ( gpg_bin => $opts->{GpgBin} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | ▶ | ( defined( $opts->{Digest} ) ? ( digest => $opts->{Digest} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ()) || (return $self->pass_error('Mail::Make::GPG'->error))
MC/DC0%0/1
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ()) || (return $self->pass_error('Mail::Make::GPG'->error))
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ())
Truth table0%0/2
A
A= 'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ())
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | ) || return( $self->pass_error( Mail::Make::GPG->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | return( $gpg->sign( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | entity => $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | key_id => ( $opts->{KeyId} // '' ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | passphrase => ( $opts->{Passphrase} // undef ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | ▶ | ( defined( $opts->{Digest} ) ? ( digest => $opts->{Digest} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/7
$gpg->sign('entity', $self, 'key_id', $opts->{'KeyId'} // '', 'passphrase', $opts->{'Passphrase'} // undef, defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ()) || $self->pass_error($gpg->error)
$opts->{"KeyId"} // ""
$opts->{"Passphrase"} // undef
MC/DC0%0/2
$gpg->sign('entity', $self, 'key_id', $opts->{'KeyId'} // '', 'passphrase', $opts->{'Passphrase'} // undef, defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ()) || $self->pass_error($gpg->error)
$gpg->sign('entity', $self, 'key_id', $opts->{'KeyId'} // '', 'passphrase', $opts->{'Passphrase'} // undef, defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ())
$self->pass_error($gpg->error)
MC/DC0%0/1
$opts->{"KeyId"} // ""
$opts->{"KeyId"}
MC/DC0%0/1
$opts->{"Passphrase"} // undef
$opts->{"Passphrase"}
Truth table0%0/3
A || B
A= $gpg->sign('entity', $self, 'key_id', $opts->{'KeyId'} // '', 'passphrase', $opts->{'Passphrase'} // undef, defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ())B= $self->pass_error($gpg->error)
Truth table0%0/2
A
A= $opts->{"KeyId"}
Truth table0%0/2
A
A= $opts->{"Passphrase"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | ) || $self->pass_error( $gpg->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | # gpg_sign_encrypt( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | # Signs then encrypts this message. Returns a new Mail::Make object whose body is a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | # RFC 3156 multipart/encrypted structure containing a signed and encrypted payload. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | # Required options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | # KeyId => '35ADBC3AF8355E845139D8965F3C0261CDB2E752' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | # Recipients => [ 'alice@example.com', ... ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | # Optional options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | # Passphrase => 'secret' # or CODE ref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | # Digest => 'SHA256' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | # GpgBin => '/usr/bin/gpg2' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | # KeyServer => 'keys.openpgp.org' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | # AutoFetch => 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | sub gpg_sign_encrypt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gpg_sign_encrypt: not called CC=12 SCAR=50.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 0 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | require Mail::Make::GPG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | my $gpg = Mail::Make::GPG->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | ( defined( $opts->{GpgBin} ) ? ( gpg_bin => $opts->{GpgBin} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | ( defined( $opts->{Digest} ) ? ( digest => $opts->{Digest} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | ( defined( $opts->{KeyServer} ) ? ( keyserver => $opts->{KeyServer} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | ▶ | ( defined( $opts->{AutoFetch} ) ? ( auto_fetch => $opts->{AutoFetch} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/2
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : (), defined $opts->{'KeyServer'} ? ('keyserver', $opts->{'KeyServer'}) : (), defined $opts->{'AutoFetch'} ? ('auto_fetch', $opts->{'AutoFetch'}) : ()) || (return $self->pass_error('Mail::Make::GPG'->error))
MC/DC0%0/1
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : (), defined $opts->{'KeyServer'} ? ('keyserver', $opts->{'KeyServer'}) : (), defined $opts->{'AutoFetch'} ? ('auto_fetch', $opts->{'AutoFetch'}) : ()) || (return $self->pass_error('Mail::Make::GPG'->error))
'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : (), defined $opts->{'KeyServer'} ? ('keyserver', $opts->{'KeyServer'}) : (), defined $opts->{'AutoFetch'} ? ('auto_fetch', $opts->{'AutoFetch'}) : ())
Truth table0%0/2
A
A= 'Mail::Make::GPG'->new(defined $opts->{'GpgBin'} ? ('gpg_bin', $opts->{'GpgBin'}) : (), defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : (), defined $opts->{'KeyServer'} ? ('keyserver', $opts->{'KeyServer'}) : (), defined $opts->{'AutoFetch'} ? ('auto_fetch', $opts->{'AutoFetch'}) : ())
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | ) || return( $self->pass_error( Mail::Make::GPG->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | my $recipients = $opts->{Recipients} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | ▶ | return( $self->error( 'gpg_sign_encrypt(): Recipients option is required.' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{'Recipients'} || (return $self->error('gpg_sign_encrypt(): Recipients option is required.'))
MC/DC0%0/1
$opts->{'Recipients'} || (return $self->error('gpg_sign_encrypt(): Recipients option is required.'))
$opts->{'Recipients'}
Truth table0%0/2
A
A= $opts->{'Recipients'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | ▶ | $recipients = [ $recipients ] unless( ref( $recipients ) eq 'ARRAY' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | return( $gpg->sign_encrypt( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | entity => $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | key_id => ( $opts->{KeyId} // '' ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | passphrase => ( $opts->{Passphrase} // undef ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | recipients => $recipients, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | ▶ | ( defined( $opts->{Digest} ) ? ( digest => $opts->{Digest} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/7
$gpg->sign_encrypt('entity', $self, 'key_id', $opts->{'KeyId'} // '', 'passphrase', $opts->{'Passphrase'} // undef, 'recipients', $recipients, defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ()) || $self->pass_error($gpg->error)
$opts->{"KeyId"} // ""
$opts->{"Passphrase"} // undef
MC/DC0%0/2
$gpg->sign_encrypt('entity', $self, 'key_id', $opts->{'KeyId'} // '', 'passphrase', $opts->{'Passphrase'} // undef, 'recipients', $recipients, defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ()) || $self->pass_error($gpg->error)
$gpg->sign_encrypt('entity', $self, 'key_id', $opts->{'KeyId'} // '', 'passphrase', $opts->{'Passphrase'} // undef, 'recipients', $recipients, defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ())
$self->pass_error($gpg->error)
MC/DC0%0/1
$opts->{"KeyId"} // ""
$opts->{"KeyId"}
MC/DC0%0/1
$opts->{"Passphrase"} // undef
$opts->{"Passphrase"}
Truth table0%0/3
A || B
A= $gpg->sign_encrypt('entity', $self, 'key_id', $opts->{'KeyId'} // '', 'passphrase', $opts->{'Passphrase'} // undef, 'recipients', $recipients, defined $opts->{'Digest'} ? ('digest', $opts->{'Digest'}) : ())B= $self->pass_error($gpg->error)
Truth table0%0/2
A
A= $opts->{"KeyId"}
Truth table0%0/2
A
A= $opts->{"Passphrase"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | ) || $self->pass_error( $gpg->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | # smime_encrypt( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | # Encrypts this message for one or more recipients. Returns a new Mail::Make object whose | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | # entity is a RFC 5751 application/pkcs7-mime enveloped message. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | # Required options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | # RecipientCert => $pem_string_or_path (or arrayref of either) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | # Optional options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | # CACert => $pem_string_or_path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | sub smime_encrypt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
smime_encrypt: not called CC=5 SCAR=34.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | require Mail::Make::SMIME; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | my $smime = Mail::Make::SMIME->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | ▶ | ( defined( $opts->{CACert} ) ? ( ca_cert => $opts->{CACert} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
'Mail::Make::SMIME'->new(defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ()) || (return $self->pass_error('Mail::Make::SMIME'->error))
MC/DC0%0/1
'Mail::Make::SMIME'->new(defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ()) || (return $self->pass_error('Mail::Make::SMIME'->error))
'Mail::Make::SMIME'->new(defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ())
Truth table0%0/2
A
A= 'Mail::Make::SMIME'->new(defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ())
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | ) || return( $self->pass_error( Mail::Make::SMIME->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | return( $smime->encrypt( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | entity => $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | ▶ | RecipientCert => ( $opts->{RecipientCert} || return( $self->error( 'smime_encrypt(): RecipientCert option is required.' ) ) ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$smime->encrypt('entity', $self, 'RecipientCert', $opts->{'RecipientCert'} || (return $self->error('smime_encrypt(): RecipientCert option is required.'))) || $self->pass_error($smime->error)
$opts->{'RecipientCert'} || (return $self->error('smime_encrypt(): RecipientCert option is required.'))
MC/DC0%0/2
$smime->encrypt('entity', $self, 'RecipientCert', $opts->{'RecipientCert'} || (return $self->error('smime_encrypt(): RecipientCert option is required.'))) || $self->pass_error($smime->error)
$smime->encrypt('entity', $self, 'RecipientCert', $opts->{'RecipientCert'} || (return $self->error('smime_encrypt(): RecipientCert option is required.')))
$self->pass_error($smime->error)
MC/DC0%0/1
$opts->{'RecipientCert'} || (return $self->error('smime_encrypt(): RecipientCert option is required.'))
$opts->{'RecipientCert'}
Truth table0%0/3
A || B
A= $smime->encrypt('entity', $self, 'RecipientCert', $opts->{'RecipientCert'} || (return $self->error('smime_encrypt(): RecipientCert option is required.')))B= $self->pass_error($smime->error)
Truth table0%0/2
A
A= $opts->{'RecipientCert'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | ) || $self->pass_error( $smime->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | # smime_sign( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | # Signs this message and returns a new Mail::Make object whose entity is a RFC 5751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | # multipart/signed structure with a detached S/MIME signature. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | # Required options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | # Cert => $pem_string_or_path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | # Key => $pem_string_or_path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | # Optional options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | # KeyPassword => $string_or_coderef | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | # CACert => $pem_string_or_path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | sub smime_sign | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
smime_sign: not called CC=7 SCAR=40.3
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | require Mail::Make::SMIME; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | my $smime = Mail::Make::SMIME->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | ( defined( $opts->{Cert} ) ? ( cert => $opts->{Cert} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | ( defined( $opts->{Key} ) ? ( key => $opts->{Key} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | ( defined( $opts->{KeyPassword} ) ? ( key_password => $opts->{KeyPassword} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 0 | ▶ | ( defined( $opts->{CACert} ) ? ( ca_cert => $opts->{CACert} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/2
'Mail::Make::SMIME'->new(defined $opts->{'Cert'} ? ('cert', $opts->{'Cert'}) : (), defined $opts->{'Key'} ? ('key', $opts->{'Key'}) : (), defined $opts->{'KeyPassword'} ? ('key_password', $opts->{'KeyPassword'}) : (), defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ()) || (return $self->pass_error('Mail::Make::SMIME'->error))
MC/DC0%0/1
'Mail::Make::SMIME'->new(defined $opts->{'Cert'} ? ('cert', $opts->{'Cert'}) : (), defined $opts->{'Key'} ? ('key', $opts->{'Key'}) : (), defined $opts->{'KeyPassword'} ? ('key_password', $opts->{'KeyPassword'}) : (), defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ()) || (return $self->pass_error('Mail::Make::SMIME'->error))
'Mail::Make::SMIME'->new(defined $opts->{'Cert'} ? ('cert', $opts->{'Cert'}) : (), defined $opts->{'Key'} ? ('key', $opts->{'Key'}) : (), defined $opts->{'KeyPassword'} ? ('key_password', $opts->{'KeyPassword'}) : (), defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ())
Truth table0%0/2
A
A= 'Mail::Make::SMIME'->new(defined $opts->{'Cert'} ? ('cert', $opts->{'Cert'}) : (), defined $opts->{'Key'} ? ('key', $opts->{'Key'}) : (), defined $opts->{'KeyPassword'} ? ('key_password', $opts->{'KeyPassword'}) : (), defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ())
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | ) || return( $self->pass_error( Mail::Make::SMIME->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | ▶ | return( $smime->sign( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$smime->sign('entity', $self) || $self->pass_error($smime->error)
MC/DC0%0/2
$smime->sign('entity', $self) || $self->pass_error($smime->error)
$smime->sign('entity', $self)
$self->pass_error($smime->error)
Truth table0%0/3
A || B
A= $smime->sign('entity', $self)B= $self->pass_error($smime->error)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | entity => $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | ) || $self->pass_error( $smime->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | # smime_sign_encrypt( %opts ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | # Signs then encrypts this message. Returns a new Mail::Make object whose entity is a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | # RFC 5751 enveloped message containing a signed payload. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | # Required options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | # Cert => $pem_string_or_path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | # Key => $pem_string_or_path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | # RecipientCert => $pem_string_or_path (or arrayref of either) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | # Optional options: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | # KeyPassword => $string_or_coderef | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | # CACert => $pem_string_or_path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | sub smime_sign_encrypt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
smime_sign_encrypt: not called CC=8 SCAR=42.8
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 0 | my $opts = $self->_get_args_as_hash( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 0 | require Mail::Make::SMIME; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | my $smime = Mail::Make::SMIME->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | ( defined( $opts->{Cert} ) ? ( cert => $opts->{Cert} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | ( defined( $opts->{Key} ) ? ( key => $opts->{Key} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | ( defined( $opts->{KeyPassword} ) ? ( key_password => $opts->{KeyPassword} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | ▶ | ( defined( $opts->{CACert} ) ? ( ca_cert => $opts->{CACert} ) : () ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/2
'Mail::Make::SMIME'->new(defined $opts->{'Cert'} ? ('cert', $opts->{'Cert'}) : (), defined $opts->{'Key'} ? ('key', $opts->{'Key'}) : (), defined $opts->{'KeyPassword'} ? ('key_password', $opts->{'KeyPassword'}) : (), defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ()) || (return $self->pass_error('Mail::Make::SMIME'->error))
MC/DC0%0/1
'Mail::Make::SMIME'->new(defined $opts->{'Cert'} ? ('cert', $opts->{'Cert'}) : (), defined $opts->{'Key'} ? ('key', $opts->{'Key'}) : (), defined $opts->{'KeyPassword'} ? ('key_password', $opts->{'KeyPassword'}) : (), defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ()) || (return $self->pass_error('Mail::Make::SMIME'->error))
'Mail::Make::SMIME'->new(defined $opts->{'Cert'} ? ('cert', $opts->{'Cert'}) : (), defined $opts->{'Key'} ? ('key', $opts->{'Key'}) : (), defined $opts->{'KeyPassword'} ? ('key_password', $opts->{'KeyPassword'}) : (), defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ())
Truth table0%0/2
A
A= 'Mail::Make::SMIME'->new(defined $opts->{'Cert'} ? ('cert', $opts->{'Cert'}) : (), defined $opts->{'Key'} ? ('key', $opts->{'Key'}) : (), defined $opts->{'KeyPassword'} ? ('key_password', $opts->{'KeyPassword'}) : (), defined $opts->{'CACert'} ? ('ca_cert', $opts->{'CACert'}) : ())
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | ) || return( $self->pass_error( Mail::Make::SMIME->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | return( $smime->sign_encrypt( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | entity => $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | RecipientCert => ( $opts->{RecipientCert} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | ▶ | return( $self->error( 'smime_sign_encrypt(): RecipientCert option is required.' ) ) ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$smime->sign_encrypt('entity', $self, 'RecipientCert', $opts->{'RecipientCert'} || (return $self->error('smime_sign_encrypt(): RecipientCert option is required.'))) || $self->pass_error($smime->error)
$opts->{'RecipientCert'} || (return $self->error('smime_sign_encrypt(): RecipientCert option is required.'))
MC/DC0%0/2
$smime->sign_encrypt('entity', $self, 'RecipientCert', $opts->{'RecipientCert'} || (return $self->error('smime_sign_encrypt(): RecipientCert option is required.'))) || $self->pass_error($smime->error)
$smime->sign_encrypt('entity', $self, 'RecipientCert', $opts->{'RecipientCert'} || (return $self->error('smime_sign_encrypt(): RecipientCert option is required.')))
$self->pass_error($smime->error)
MC/DC0%0/1
$opts->{'RecipientCert'} || (return $self->error('smime_sign_encrypt(): RecipientCert option is required.'))
$opts->{'RecipientCert'}
Truth table0%0/3
A || B
A= $smime->sign_encrypt('entity', $self, 'RecipientCert', $opts->{'RecipientCert'} || (return $self->error('smime_sign_encrypt(): RecipientCert option is required.')))B= $self->pass_error($smime->error)
Truth table0%0/2
A
A= $opts->{'RecipientCert'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | ) || $self->pass_error( $smime->error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | # _default_domain() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | # Returns a reasonable FQDN for auto-generating Message-IDs. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | # Uses Sys::Hostname (core) and falls back to 'mail.make.local'. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | sub _default_domain | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 45 | ▶ | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_domain: called CC=5 SCAR=17.8
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 45 | local $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | my $host = eval | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 45 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 45 | require Sys::Hostname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 45 | Sys::Hostname::hostname(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 45 | ▶ | return( 'mail.make.local' ) if( $@ || !defined( $host ) || !length( $host ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$@ or not defined $host or not length $host
$@ or not defined $host
MC/DC0%0/3
$@ or not defined $host or not length $host
$@
not defined $host
not length $host
Truth table25%1/4
A or not(B) or not(C)
A= $@B= not defined $hostC= not length $host
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | # If it is not a FQDN (no dot), append .local to avoid rejection by | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | # Mail::Make::Headers::_generate_message_id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 45 | ▶ | $host .= '.local' if( index( $host, '.' ) == -1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 45 | return( $host ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | # _encode_address( $addr_string ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | # Encodes the display name portion of an RFC 2822 address using RFC 2047 when it contains | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | # non-ASCII characters. The addr-spec (the part inside angle brackets) is never altered. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | # Recognised forms: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | # "Display Name" <local@domain> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | # Display Name <local@domain> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | # local@domain (bare addr-spec, passed through unchanged) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | # Returns the wire-safe string. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | sub _encode_address | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 103 | ▶ | my( $self, $addr ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_encode_address: called CC=5 SCAR=16.4
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 103 | ▶ | return( $addr ) unless( defined( $addr ) && length( $addr ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $addr and length $addr
MC/DC0%0/2
defined $addr and length $addr
defined $addr
length $addr
Truth table33%1/3
A and B
A= defined $addrB= length $addr
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 103 | ▶ | if( $addr =~ /^("?)([^<"]+)\1\s*<([^>]+)>\s*$/ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 7 | my( $name, $spec ) = ( $2, $3 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 7 | $name =~ s/^\s+|\s+$//g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 7 | my $enc = $self->_encode_header( $name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | # If the name was encoded (contains non-ASCII), the encoded-word is | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | # self-quoting and must NOT be surrounded by double-quotes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | # If it is plain ASCII, keep surrounding quotes for correct parsing. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 7 | ▶ | return( $enc ne $name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | ? "${enc} <${spec}>" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | : qq{"${name}" <${spec}>} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | # Bare addr-spec - nothing to encode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 96 | return( $addr ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | # _encode_header( $string ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | # Encodes a header value for the wire using RFC 2047 if necessary. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | # Delegates to Mail::Make::Headers::Subject which handles fragmentation, fold points, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | # and UTF-8 boundary safety. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | sub _encode_header | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 46 | ▶ | my( $self, $str ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_encode_header: called CC=2 SCAR=7.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 46 | ▶ | return( $str ) unless( defined( $str ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 46 | my $s = Mail::Make::Headers::Subject->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 46 | $s->value( $str ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 46 | return( $s->as_string ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | # _format_date() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | # Returns the current date/time in RFC 2822 format. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | sub _format_date | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 53 | ▶ | my @t = localtime( time ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format_date: called CC=8 SCAR=23.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 53 | my @day = qw( Sun Mon Tue Wed Thu Fri Sat ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 53 | my @mon = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | my $tz = do | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 53 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 53 | my @lt = localtime( time ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 53 | my @gt = gmtime( time ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 53 | my $diff = ( $lt[2] - $gt[2] ) * 60 + ( $lt[1] - $gt[1] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 53 | ▶ | $diff += 1440 if( $lt[5] > $gt[5] || ( $lt[5] == $gt[5] && $lt[7] > $gt[7] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$lt[5] > $gt[5] or $lt[5] == $gt[5] and $lt[7] > $gt[7]
$lt[5] == $gt[5] and $lt[7] > $gt[7]
MC/DC0%0/3
$lt[5] > $gt[5] or $lt[5] == $gt[5] and $lt[7] > $gt[7]
$lt[5] > $gt[5]
$lt[5] == $gt[5]
$lt[7] > $gt[7]
Truth table25%1/4
A or B and C
A= $lt[5] > $gt[5]B= $lt[5] == $gt[5]C= $lt[7] > $gt[7]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 53 | ▶ | $diff -= 1440 if( $lt[5] < $gt[5] || ( $lt[5] == $gt[5] && $lt[7] < $gt[7] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$lt[5] < $gt[5] or $lt[5] == $gt[5] and $lt[7] < $gt[7]
$lt[5] == $gt[5] and $lt[7] < $gt[7]
MC/DC0%0/3
$lt[5] < $gt[5] or $lt[5] == $gt[5] and $lt[7] < $gt[7]
$lt[5] < $gt[5]
$lt[5] == $gt[5]
$lt[7] < $gt[7]
Truth table25%1/4
A or B and C
A= $lt[5] < $gt[5]B= $lt[5] == $gt[5]C= $lt[7] < $gt[7]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 53 | ▶ | my $sign = $diff >= 0 ? '+' : '-'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 53 | $diff = abs( $diff ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 53 | sprintf( '%s%02d%02d', $sign, int( $diff / 60 ), $diff % 60 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 53 | return( sprintf( '%s, %02d %s %04d %02d:%02d:%02d %s', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | $day[ $t[6] ], $t[3], $mon[ $t[4] ], $t[5] + 1900, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | $t[2], $t[1], $t[0], $tz ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | # NOTE: STORABLE support | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 0 | ▶ | sub STORABLE_freeze { CORE::return( CORE::shift->FREEZE( @_ ) ); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORABLE_freeze: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 0 | ▶ | sub STORABLE_thaw { CORE::return( CORE::shift->THAW( @_ ) ); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORABLE_thaw: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 6 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | # NOTE: POD | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||