line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Email Server Worker |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Email::Sender::Server::Worker; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
450
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Email::Sender::Server::Base'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
51
|
use Carp 'confess'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
382
|
|
11
|
1
|
|
|
1
|
|
8
|
use File::Path 'mkpath'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
75
|
|
12
|
1
|
|
|
1
|
|
6
|
use File::Slurp 'write_file'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
78
|
|
13
|
1
|
|
|
1
|
|
7
|
use File::Spec::Functions 'curdir', 'catdir', 'catfile', 'splitdir'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
74
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
7
|
use Email::Sender::Server::Message; |
|
1
|
|
|
|
|
29
|
|
|
1
|
|
|
|
|
24
|
|
16
|
1
|
|
|
1
|
|
5
|
use Class::Date; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
20
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '1.000001'; # VERSION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has id => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
default => $$ |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has workspace => ( |
27
|
|
|
|
|
|
|
is => 'rw', |
28
|
|
|
|
|
|
|
lazy => 1, |
29
|
|
|
|
|
|
|
default => sub { |
30
|
|
|
|
|
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
$self->directory('worker', $self->id); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub BUILD { |
36
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $workspace = $self->workspace; |
39
|
|
|
|
|
|
|
|
40
|
0
|
0
|
0
|
|
|
|
unless (-d $workspace && -w $workspace) { |
41
|
0
|
|
|
|
|
|
confess "Couldn't find or access (write-to) the worker's workspace ". |
42
|
|
|
|
|
|
|
$workspace; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub process_message { |
49
|
0
|
|
|
0
|
0
|
|
my ($self, $data) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $message = Email::Sender::Server::Message->new($data); |
52
|
0
|
|
|
|
|
|
$message->send; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $message; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |