line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Email::MIME::Kit::Bulk::Command; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
10
|
|
|
10
|
|
142207
|
$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.1'; |
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
69
|
use strict; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
269
|
|
9
|
10
|
|
|
10
|
|
29
|
use warnings; |
|
10
|
|
|
|
|
11
|
|
|
10
|
|
|
|
|
226
|
|
10
|
|
|
|
|
|
|
|
11
|
10
|
|
|
10
|
|
4028
|
use MooseX::App::Simple; |
|
10
|
|
|
|
|
6513310
|
|
|
10
|
|
|
|
|
50
|
|
12
|
|
|
|
|
|
|
|
13
|
10
|
|
|
10
|
|
7620777
|
use Email::MIME::Kit::Bulk; |
|
10
|
|
|
|
|
39
|
|
|
10
|
|
|
|
|
312
|
|
14
|
10
|
|
|
10
|
|
70
|
use Email::MIME::Kit::Bulk::Target; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
121
|
|
15
|
10
|
|
|
10
|
|
30
|
use JSON; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
69
|
|
16
|
10
|
|
|
10
|
|
1562
|
use MooseX::Types::Path::Tiny qw/ Path /; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
124
|
|
17
|
10
|
|
|
10
|
|
17248
|
use PerlX::Maybe; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
3245
|
|
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
|
18
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
18
|
|
|
|
|
180
|
die 'Kit directory must have a manifest' |
62
|
45
|
|
|
|
|
1242
|
unless grep { -r } |
63
|
|
|
|
|
|
|
grep { |
64
|
9
|
50
|
|
|
|
252
|
my $f = $_->basename; |
65
|
45
|
100
|
|
|
|
657
|
$f =~ /^manifest\./ && $f =~ /\.json$/ |
66
|
|
|
|
|
|
|
} $self->kit->children; |
67
|
|
|
|
|
|
|
|
68
|
9
|
50
|
|
|
|
405
|
die 'Cannot find target specification (' . $self->_targets_file . ')' |
69
|
|
|
|
|
|
|
unless -e $self->_targets_file; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub run { |
73
|
9
|
|
|
9
|
0
|
18
|
my $self = shift; |
74
|
|
|
|
|
|
|
|
75
|
9
|
|
|
|
|
9
|
my @addresses = @{ decode_json($self->_targets_file->slurp) }; |
|
9
|
|
|
|
|
207
|
|
76
|
|
|
|
|
|
|
|
77
|
18
|
|
|
|
|
459
|
my $mailer = Email::MIME::Kit::Bulk->new( |
78
|
|
|
|
|
|
|
verbose => !$self->quiet, |
79
|
9
|
|
|
|
|
1458
|
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
|
|
|
|
|
45
|
$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.1 |
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 |