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   1797698 use v5.12.0;
  19         68  
2 19     19   166 use warnings;
  19         47  
  19         1607  
3             package Email::MIME::Creator 1.954;
4             # ABSTRACT: obsolete do-nothing library
5              
6 19     19   627 use parent q[Email::Simple::Creator];
  19         401  
  19         135  
7 19     19   9203 use Email::MIME;
  19         60  
  19         689  
8 19     19   2276 use Encode ();
  19         77036  
  19         2809  
9              
10             sub _construct_part {
11 14     14   60 my ($class, $body) = @_;
12              
13 14         36 my $is_binary = $body =~ /[\x00\x80-\xFF]/;
14              
15 14 100       35 my $content_type = $is_binary ? 'application/x-binary' : 'text/plain';
16              
17 14 100       118 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__