blib/lib/Email/Sender/Transport/Print.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 83.7% 31 / 37 CC 3 SCAR 6.4
CC
3
Cov
90%
send_email
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.9
« blib/lib/Email/Sender/Manual/QuickStart.pm ↑ Summary blib/lib/Email/Sender/Transport.pm »
1 package Email::Sender::Transport::Print 2.603;
2 # ABSTRACT: print email to a filehandle (like stdout)
3  
4 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 with 'Email::Sender::Transport';
6  
7 #pod =head1 DESCRIPTION
8 #pod
9 #pod When this transport is handed mail, it prints it to a filehandle. By default,
10 #pod it will print to STDOUT, but it can be given any L<IO::Handle> object to print
11 #pod to as its C<fh> attribute.
12 #pod
13 #pod =cut
14  
15 2 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use MooX::Types::MooseLike::Base qw(InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 has 'fh' => (
19 is => 'ro',
20 isa => InstanceOf['IO::Handle'],
21 required => 1,
22 0 ▶ default => sub { IO::Handle->new_from_fd(fileno(STDOUT), 'w') },
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 2 );
24  
25 1 ▶sub send_email {
Subroutine send_email: called CC=3 SCAR=11.1
Pod undocumented
26 1 my ($self, $email, $env) = @_;
27  
28 1 my $fh = $self->fh;
29  
30 1 ▶ $fh->printf("ENVELOPE TO : %s\n", join(q{, }, @{ $env->{to} }) || '-');
Condition50%1/2
join(', ', @{$env->{'to'};}) || '-'
l!l
10
MC/DC0%0/1
join(', ', @{$env->{'to'};}) || '-'
join(', ', @{$env->{'to'};})
Truth table50%1/2
A
A= join(', ', @{$env->{'to'};})
Aresult
11
00
31 1 ▶ $fh->printf("ENVELOPE FROM: %s\n", defined $env->{from} ? $env->{from} : '-');
Branch: 1 branch
BranchTrueFalseTotal
defined $env->{'from'} ? : 1 0 1
32 1 $fh->print(q{-} x 10 . " begin message\n");
33  
34 1 $fh->print( $email->as_string );
35  
36 1 $fh->print(q{-} x 10 . " end message\n");
37  
38 1 return $self->success;
39 }
40  
41 2 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 2 1;
43  
44 __END__
« blib/lib/Email/Sender/Manual/QuickStart.pm ↑ Summary blib/lib/Email/Sender/Transport.pm »