File Coverage

blib/lib/Email/Simple/Creator.pm
Criterion Covered Total %
statement 21 21 100.0
branch 8 8 100.0
condition n/a
subroutine 7 7 100.0
pod n/a
total 36 36 100.0


line stmt bran cond sub pod time code
1 22     22   126 use strict;
  22         38  
  22         539  
2 22     22   92 use warnings;
  22         34  
  22         907  
3             package Email::Simple::Creator;
4             # ABSTRACT: private helper for building Email::Simple objects
5             $Email::Simple::Creator::VERSION = '2.217'; # TRIAL
6 22     22   119 use Carp ();
  22         38  
  22         6451  
7              
8             sub _crlf {
9 64     64   185 "\x0d\x0a";
10             }
11              
12             sub _date_header {
13 10     10   1245 require Email::Date::Format;
14 10         8499 Email::Date::Format::email_date();
15             }
16              
17             our @CARP_NOT = qw(Email::Simple Email::MIME);
18              
19             sub _add_to_header {
20 25     25   44 my ($class, $header, $key, $value) = @_;
21 25 100       43 $value = '' unless defined $value;
22              
23 25 100       190 Carp::carp "Header name '$key' with wide characters" if $key =~ /[^\x00-\xFF]/;
24 25 100       246 Carp::carp "Value '$value' for '$key' header with wide characters" if $value =~ /[^\x00-\xFF]/;
25              
26 25 100       89 if ($value =~ s/[\x0a\x0b\x0c\x0d\x85\x{2028}\x{2029}]+/ /g) {
27 1         205 Carp::carp("replaced vertical whitespace in $key header with space; this will become fatal in a future version");
28             }
29              
30 25         103 $$header .= Email::Simple::Header->__fold_objless("$key: $value", 78, q{ }, $class->_crlf);
31             }
32              
33             sub _finalize_header {
34 13     13   21 my ($class, $header) = @_;
35 13         27 $$header .= $class->_crlf;
36             }
37              
38             1;
39              
40             __END__