line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Email::Sender::Transport::Print 2.600; |
2
|
|
|
|
|
|
|
# ABSTRACT: print email to a filehandle (like stdout) |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1674
|
use Moo; |
|
2
|
|
|
|
|
2441
|
|
|
2
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
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 object to print |
11
|
|
|
|
|
|
|
#pod to as its C attribute. |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod =cut |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
2045
|
use IO::Handle; |
|
2
|
|
|
|
|
5670
|
|
|
2
|
|
|
|
|
89
|
|
16
|
2
|
|
|
2
|
|
461
|
use MooX::Types::MooseLike::Base qw(InstanceOf); |
|
2
|
|
|
|
|
6387
|
|
|
2
|
|
|
|
|
468
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'fh' => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
isa => InstanceOf['IO::Handle'], |
21
|
|
|
|
|
|
|
required => 1, |
22
|
|
|
|
|
|
|
default => sub { IO::Handle->new_from_fd(fileno(STDOUT), 'w') }, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub send_email { |
26
|
1
|
|
|
1
|
0
|
3
|
my ($self, $email, $env) = @_; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
4
|
my $fh = $self->fh; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
50
|
|
|
3
|
$fh->printf("ENVELOPE TO : %s\n", join(q{, }, @{ $env->{to} }) || '-'); |
31
|
1
|
50
|
|
|
|
13
|
$fh->printf("ENVELOPE FROM: %s\n", defined $env->{from} ? $env->{from} : '-'); |
32
|
1
|
|
|
|
|
7
|
$fh->print(q{-} x 10 . " begin message\n"); |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
8
|
$fh->print( $email->as_string ); |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
100
|
$fh->print(q{-} x 10 . " end message\n"); |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
5
|
return $self->success; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
2
|
|
17
|
no Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |