| 1 | # This code is part of Perl distribution Mail-Message version 4.05. | ||||||||||||||||||||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.06. | ||||||||||||||||||||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | # This software is copyright (c) 2001-2026 by Mark Overmeer. | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | package Mail::Message::TransferEnc::Base64;{ | ||||||||||||||||||||||||||||
| 13 | 5 | our $VERSION = '4.05'; | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use parent 'Mail::Message::TransferEnc'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 5 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 5 | ▶ | use Log::Report 'mail-message', import => [ qw/warning/ ]; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 5 | ▶ | use MIME::Base64 qw/decode_base64 encode_base64/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | #-------------------- | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | sub name() { 'base64' } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | sub check($@) | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | { my ($self, $body, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
check: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | 0 | $body; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | sub decode($@) | ||||||||||||||||||||||||||||
| 37 | 2 | ▶ | { my ($self, $body, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
decode: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 2 | my $lines = decode_base64($body->string); | |||||||||||||||||||||||||||
| 40 | 2 | ▶ | unless($lines) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 0 | { $body->transferEncoding('none'); | |||||||||||||||||||||||||||
| 42 | 0 | return $body; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 2 | ▶ | my $bodytype = $args{result_type} || ($body->isBinary ? 'Mail::Message::Body::File' : ref $body); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args{'result_type'} || ($body->isBinary ? 'Mail::Message::Body::File' : ref $body)
MC/DC0%0/2
$args{'result_type'} || ($body->isBinary ? 'Mail::Message::Body::File' : ref $body)
$args{'result_type'}
($body->isBinary ? 'Mail::Message::Body::File' : ref $body)
Truth table66%2/3
A || B
A= $args{'result_type'}B= ($body->isBinary ? 'Mail::Message::Body::File' : ref $body)
| |||||||||||||||||||||||||||||
| 46 | 2 | $bodytype->new(based_on => $body, transfer_encoding => 'none', data => $lines); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | sub encode($@) | ||||||||||||||||||||||||||||
| 50 | 4 | ▶ | { my ($self, $body, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
encode: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | 4 | ▶ | my $bodytype = $args{result_type} || ref $body; | ||||||||||||||||||||||||||
|
Condition66%2/3
$args{'result_type'} || ref $body
MC/DC0%0/2
$args{'result_type'} || ref $body
$args{'result_type'}
ref $body
Truth table66%2/3
A || B
A= $args{'result_type'}B= ref $body
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 4 | $bodytype->new( | |||||||||||||||||||||||||||
| 54 | based_on => $body, | ||||||||||||||||||||||||||||
| 55 | checked => 1, | ||||||||||||||||||||||||||||
| 56 | transfer_encoding => 'base64', | ||||||||||||||||||||||||||||
| 57 | data => encode_base64($body->string), | ||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 5 | 1; | |||||||||||||||||||||||||||