line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
932
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
65
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Mail::Qmail::Filter::Dump; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
7
|
use Mo qw(coerce required); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
extends 'Mail::Qmail::Filter'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'to' => required => 1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub filter { |
14
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
15
|
0
|
|
|
|
|
|
my $message = $self->message; |
16
|
0
|
0
|
0
|
|
|
|
require Path::Tiny and Path::Tiny->import('path') |
17
|
|
|
|
|
|
|
unless defined &path; |
18
|
0
|
|
|
|
|
|
my $dest = path( $self->to ); |
19
|
0
|
|
|
|
|
|
state $i = 0; |
20
|
0
|
0
|
|
|
|
|
$dest = $dest->child( join '_', $^T, $$, ++$i ) if $dest->is_dir; |
21
|
0
|
|
|
|
|
|
$dest->spew( $message->body ); |
22
|
0
|
|
|
|
|
|
$self->debug( 'dumped message to' => $dest ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Mail::Qmail::Filter::Dump - |
32
|
|
|
|
|
|
|
dump message to file |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use Mail::Qmail::Filter; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Mail::Qmail::Filter->new->add_filter( |
39
|
|
|
|
|
|
|
'::Dump' => { |
40
|
|
|
|
|
|
|
'to' => '/path/to/write/to', |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
)->run; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This L<Mail::Qmail::Filter> plugin writes the message to a file |
47
|
|
|
|
|
|
|
(for debugging purposes). |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 REQUIRED PARAMETERS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 to |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Where to write the message to. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
May be the name of a file or an existing directory. |
56
|
|
|
|
|
|
|
In the latter case, will create a file named |
57
|
|
|
|
|
|
|
C<E<lt>epoch_time_when_script_startedE<gt>_E<lt>pidE<gt>_E<lt>serial_numberE<gt>> |
58
|
|
|
|
|
|
|
in that directory. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SEE ALSO |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
L<Mail::Qmail::Filter/COMMON PARAMETERS FOR ALL FILTERS> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Copyright 2019 Martin Sluka. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it |
69
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
70
|
|
|
|
|
|
|
copy of the full license at: |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L<http://www.perlfoundation.org/artistic_license_2_0> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified |
75
|
|
|
|
|
|
|
Versions is governed by this Artistic License. By using, modifying or |
76
|
|
|
|
|
|
|
distributing the Package, you accept this license. Do not use, modify, |
77
|
|
|
|
|
|
|
or distribute the Package, if you do not accept this license. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
80
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
81
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
84
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
87
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
88
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
89
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
90
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
91
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
92
|
|
|
|
|
|
|
direct or contributory patent infringement, then this Artistic License |
93
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
96
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
97
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
98
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
99
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
100
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
101
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
102
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |