File Coverage

blib/lib/Mail/Send.pm
Criterion Covered Total %
statement 29 32 90.6
branch 2 4 50.0
condition n/a
subroutine 10 12 83.3
pod 9 10 90.0
total 50 58 86.2


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::Send;{
10             our $VERSION = '2.22';
11             }
12              
13              
14 2     2   7009 use strict;
  2         4  
  2         84  
15              
16 2     2   620 use Mail::Mailer ();
  2         4  
  2         916  
17              
18 0     0 0 0 sub Version { our $VERSION }
19              
20             #------------------
21              
22             sub new(@)
23 2     2 1 169187 { my ($class, %attr) = @_;
24 2         6 my $self = bless {}, $class;
25              
26 2         14 while(my($key, $value) = each %attr)
27 2         6 { $key = lc $key;
28 2         9 $self->$key($value);
29             }
30              
31 2         21 $self;
32             }
33              
34             #---------------
35              
36             sub set($@)
37 10     10 1 40 { my ($self, $hdr, @values) = @_;
38 10 50       31 $self->{$hdr} = [ @values ] if @values;
39 10 50       16 @{$self->{$hdr} || []}; # return new (or original) values
  10         38  
40             }
41              
42              
43             sub add($@)
44 1     1 1 11 { my ($self, $hdr, @values) = @_;
45 1         2 push @{$self->{$hdr}}, @values;
  1         5  
46             }
47              
48              
49             sub delete($)
50 1     1 1 10 { my($self, $hdr) = @_;
51 1         4 delete $self->{$hdr};
52             }
53              
54              
55 2     2 1 7 sub to { my $self=shift; $self->set('To', @_); }
  2         6  
56 1     1 1 9 sub cc { my $self=shift; $self->set('Cc', @_); }
  1         3  
57 2     2 1 16 sub bcc { my $self=shift; $self->set('Bcc', @_); }
  2         37  
58 2     2 1 10 sub subject { my $self=shift; $self->set('Subject', join (' ', @_)); }
  2         9  
59              
60             #---------------
61              
62             sub open(@)
63 0     0 1   { my $self = shift;
64 0           Mail::Mailer->new(@_)->open($self);
65             }
66              
67             1;