Mail/Send.pm

filter: Statementstmt 91.8% 34 / 37 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 84.6% 11 / 13 Podpod 90.0% 9 / 10 totaltotal 87.8% 58 / 66 SCAR 13.9
CC
4
Cov
88%
set
3.1
Version
2.0
new
2.0
CRAP 4.0
« Mail/Field/Generic.pm ↑ Summary Mail/Field/AddrList.pm »
1 # Copyrights 1995-2019 by [Mark Overmeer <markov@cpan.org>].
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.02.
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 2 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 $VERSION = '2.21';
12  
13  
14 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 ▶use Mail::Mailer ();
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 0 ▶sub Version { our $VERSION }
Subroutine Version: not called CC=1 SCAR=6.9
Pod undocumented
19  
20 #------------------
21  
22 sub new(@)
23 2 ▶{ my ($class, %attr) = @_;
Subroutine new: called CC=2 SCAR=6.9
Pod documented
24 2 my $self = bless {}, $class;
25  
26 2 ▶ while(my($key, $value) = each %attr)
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %attr) 2 2 4
27 2 { $key = lc $key;
28 2 $self->$key($value);
29 }
30  
31 2 $self;
32 }
33  
34 #---------------
35  
36 sub set($@)
37 10 ▶{ my ($self, $hdr, @values) = @_;
Subroutine set: called CC=3 SCAR=11.4
Pod documented
38 10 ▶ $self->{$hdr} = [ @values ] if @values;
Branch: 1 branch
BranchTrueFalseTotal
if @values 10 0 10
39 10 ▶ @{$self->{$hdr} || []}; # return new (or original) values
Branch: 1 branch
BranchTrueFalseTotal
$self->{$hdr} or [] 0 10 10
40 }
41  
42  
43 sub add($@)
44 1 ▶{ my ($self, $hdr, @values) = @_;
Subroutine add: called CC=1 SCAR=0.0
Pod documented
45 1 push @{$self->{$hdr}}, @values;
46 }
47  
48  
49 sub delete($)
50 1 ▶{ my($self, $hdr) = @_;
Subroutine delete: called CC=1 SCAR=0.0
Pod documented
51 1 delete $self->{$hdr};
52 }
53  
54  
55 2 ▶sub to { my $self=shift; $self->set('To', @_); }
Subroutine to: called CC=1 SCAR=0.0
Pod documented
56 1 ▶sub cc { my $self=shift; $self->set('Cc', @_); }
Subroutine cc: called CC=1 SCAR=0.0
Pod documented
57 2 ▶sub bcc { my $self=shift; $self->set('Bcc', @_); }
Subroutine bcc: called CC=1 SCAR=0.0
Pod documented
58 2 ▶sub subject { my $self=shift; $self->set('Subject', join (' ', @_)); }
Subroutine subject: called CC=1 SCAR=0.0
Pod documented
59  
60 #---------------
61  
62 sub open(@)
63 0 ▶{ my $self = shift;
Subroutine open: not called CC=1 SCAR=6.9
Pod documented
64 0 Mail::Mailer->new(@_)->open($self);
65 }
66  
67 2 1;
« Mail/Field/Generic.pm ↑ Summary Mail/Field/AddrList.pm »