File Coverage

blib/lib/Email/MIME/Creator.pm
Criterion Covered Total %
statement 18 18 100.0
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 28 28 100.0


line stmt bran cond sub pod time code
1 19     19   3223 use v5.12.0;
  19         74  
2 19     19   138 use warnings;
  19         39  
  19         847  
3             package Email::MIME::Creator 1.953;
4             # ABSTRACT: obsolete do-nothing library
5              
6 19     19   2196 use parent q[Email::Simple::Creator];
  19         1561  
  19         100  
7 19     19   7694 use Email::MIME;
  19         67  
  19         621  
8 19     19   6876 use Encode ();
  19         127198  
  19         2152  
9              
10             sub _construct_part {
11 14     14   32 my ($class, $body) = @_;
12              
13 14         43 my $is_binary = $body =~ /[\x00\x80-\xFF]/;
14              
15 14 100       37 my $content_type = $is_binary ? 'application/x-binary' : 'text/plain';
16              
17 14 100       87 Email::MIME->create(
18             attributes => {
19             content_type => $content_type,
20             encoding => ($is_binary ? 'base64' : ''), # be safe
21             },
22             body => $body,
23             );
24             }
25              
26             1;
27              
28             #pod =head1 SYNOPSIS
29             #pod
30             #pod You don't need to use this module for anything.
31             #pod
32             #pod =cut
33              
34             __END__