| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Email::MIME::Kit::Bulk::Command; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
10
|
|
|
10
|
|
129075
|
$Email::MIME::Kit::Bulk::Command::AUTHORITY = 'cpan:YANICK'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
# ABSTRACT: send bulk emails using Email::MIME::Kit |
|
6
|
|
|
|
|
|
|
$Email::MIME::Kit::Bulk::Command::VERSION = '0.0.2'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
51
|
use strict; |
|
|
10
|
|
|
|
|
11
|
|
|
|
10
|
|
|
|
|
193
|
|
|
9
|
10
|
|
|
10
|
|
30
|
use warnings; |
|
|
10
|
|
|
|
|
11
|
|
|
|
10
|
|
|
|
|
163
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
10
|
|
|
10
|
|
3511
|
use MooseX::App::Simple; |
|
|
10
|
|
|
|
|
6085452
|
|
|
|
10
|
|
|
|
|
40
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
10
|
|
|
10
|
|
6926032
|
use Email::MIME::Kit::Bulk; |
|
|
10
|
|
|
|
|
30
|
|
|
|
10
|
|
|
|
|
308
|
|
|
14
|
10
|
|
|
10
|
|
61
|
use Email::MIME::Kit::Bulk::Target; |
|
|
10
|
|
|
|
|
10
|
|
|
|
10
|
|
|
|
|
120
|
|
|
15
|
10
|
|
|
10
|
|
30
|
use JSON; |
|
|
10
|
|
|
|
|
20
|
|
|
|
10
|
|
|
|
|
53
|
|
|
16
|
10
|
|
|
10
|
|
1195
|
use MooseX::Types::Path::Tiny qw/ Path /; |
|
|
10
|
|
|
|
|
20
|
|
|
|
10
|
|
|
|
|
123
|
|
|
17
|
10
|
|
|
10
|
|
18070
|
use PerlX::Maybe; |
|
|
10
|
|
|
|
|
19
|
|
|
|
10
|
|
|
|
|
3572
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
option kit => ( |
|
20
|
|
|
|
|
|
|
is => 'ro', |
|
21
|
|
|
|
|
|
|
isa => Path, |
|
22
|
|
|
|
|
|
|
required => 1, |
|
23
|
|
|
|
|
|
|
coerce => 1, |
|
24
|
|
|
|
|
|
|
documentation => 'path to the mime kit directory', |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
option from => ( |
|
28
|
|
|
|
|
|
|
is => 'ro', |
|
29
|
|
|
|
|
|
|
isa => 'Str', |
|
30
|
|
|
|
|
|
|
documentation => 'sender address', |
|
31
|
|
|
|
|
|
|
required => 1, |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
option processes => ( |
|
35
|
|
|
|
|
|
|
is => 'ro', |
|
36
|
|
|
|
|
|
|
isa => 'Maybe[Int]', |
|
37
|
|
|
|
|
|
|
documentation => 'nbr of parallel processes for sending emails', |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
option quiet => ( |
|
41
|
|
|
|
|
|
|
is => 'ro', |
|
42
|
|
|
|
|
|
|
isa => 'Bool', |
|
43
|
|
|
|
|
|
|
documentation => q{don't output anything}, |
|
44
|
|
|
|
|
|
|
default => 0, |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has transport => ( |
|
48
|
|
|
|
|
|
|
is => 'ro', |
|
49
|
|
|
|
|
|
|
); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has _targets_file => ( |
|
52
|
|
|
|
|
|
|
is => 'ro', |
|
53
|
|
|
|
|
|
|
isa => Path, |
|
54
|
|
|
|
|
|
|
lazy => 1, |
|
55
|
|
|
|
|
|
|
default => sub { shift->kit->child('targets.json') }, |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub BUILD { |
|
59
|
9
|
|
|
9
|
0
|
9
|
my $self = shift; |
|
60
|
|
|
|
|
|
|
|
|
61
|
18
|
|
|
|
|
189
|
die 'Kit directory must have a manifest' |
|
62
|
45
|
|
|
|
|
1143
|
unless grep { -r } |
|
63
|
|
|
|
|
|
|
grep { |
|
64
|
9
|
50
|
|
|
|
234
|
my $f = $_->basename; |
|
65
|
45
|
100
|
|
|
|
594
|
$f =~ /^manifest\./ && $f =~ /\.json$/ |
|
66
|
|
|
|
|
|
|
} $self->kit->children; |
|
67
|
|
|
|
|
|
|
|
|
68
|
9
|
50
|
|
|
|
396
|
die 'Cannot find target specification (' . $self->_targets_file . ')' |
|
69
|
|
|
|
|
|
|
unless -e $self->_targets_file; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub run { |
|
73
|
9
|
|
|
9
|
0
|
9
|
my $self = shift; |
|
74
|
|
|
|
|
|
|
|
|
75
|
9
|
|
|
|
|
9
|
my @addresses = @{ decode_json($self->_targets_file->slurp) }; |
|
|
9
|
|
|
|
|
216
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
18
|
|
|
|
|
450
|
my $mailer = Email::MIME::Kit::Bulk->new( |
|
78
|
|
|
|
|
|
|
verbose => !$self->quiet, |
|
79
|
9
|
|
|
|
|
1305
|
targets => [ map { Email::MIME::Kit::Bulk::Target->new($_) } @addresses ], |
|
80
|
|
|
|
|
|
|
kit => $self->kit, |
|
81
|
|
|
|
|
|
|
maybe from => $self->from, |
|
82
|
|
|
|
|
|
|
maybe processes => $self->processes, |
|
83
|
|
|
|
|
|
|
maybe transport => $self->transport, |
|
84
|
|
|
|
|
|
|
); |
|
85
|
|
|
|
|
|
|
|
|
86
|
9
|
|
|
|
|
36
|
$mailer->send; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=encoding UTF-8 |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 NAME |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Email::MIME::Kit::Bulk::Command - send bulk emails using Email::MIME::Kit |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 VERSION |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
version 0.0.2 |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
use Email::MIME::Kit::Bulk::Command; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Email::MIME::Kit::Bulk::Command->new_with_options->run; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHORS |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over 4 |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Jesse Luehrs <doy@cpan.org> |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Yanick Champoux <yanick.champoux@iinteractive.com> |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Infinity Interactive <contact@iinteractive.com>. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
132
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |