File Coverage

blib/lib/Mail/Mailer/rfc822.pm
Criterion Covered Total %
statement 6 16 37.5
branch 0 2 0.0
condition 0 3 0.0
subroutine 2 3 66.6
pod 0 1 0.0
total 8 25 32.0


line stmt bran cond sub pod time code
1             # Copyrights 1995-2024 by [Mark Overmeer ].
2             # For other contributors see ChangeLog.
3             # See the manual pages for details on the licensing terms.
4             # Pod stripped from pm file by OODoc 2.03.
5             # This code is part of the bundle MailTools. Meta-POD processed with
6             # OODoc into POD and HTML manual-pages. See README.md for Copyright.
7             # Licensed under the same terms as Perl itself.
8              
9             package Mail::Mailer::rfc822;{
10             our $VERSION = '2.22';
11             }
12              
13 1     1   11 use base 'Mail::Mailer';
  1         2  
  1         256  
14              
15 1     1   8 use strict;
  1         2  
  1         419  
16              
17             # Some fields are not allowed to repeat
18             my %max_once = map +($_ => 1), qw/from to cc bcc reply-to/;
19              
20             sub set_headers
21 0     0 0   { my ($self, $hdrs) = @_;
22 0           local $\ = "";
23              
24 0           foreach my $f (grep /^[A-Z]/, keys %$hdrs)
25             { # s///r requires perl 5.12: too new :-)
26 0           my @h = map { my $h = $_; $h =~ s/\n+\Z//; $h } $self->to_array($hdrs->{$f});
  0            
  0            
  0            
27 0 0 0       @h = join ', ', @h if @h && $max_once{lc $f};
28 0           print $self "$f: $_\n" for @h;
29             }
30              
31 0           print $self "\n"; # end of headers
32             }
33              
34             1;