Mail/Qmail/Filter/LogEnvelope.pm

filter: Statementstmt 68.7% 11 / 16 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 51.7% 15 / 29 SCAR 17.9
CC
4
Cov
50%
filter
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.0
« Mail/Qmail/Filter/Dump.pm ↑ Summary Mail/Qmail/Filter/RewriteFrom.pm »
1 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Mail::Qmail::Filter::LogEnvelope;
5  
6 1 our $VERSION = '1.0';
7  
8 1 ▶use Mo qw(coerce);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 extends 'Mail::Qmail::Filter';
10  
11 sub filter {
12 0 ▶ my $self = shift;
Subroutine filter: not called CC=4 SCAR=30.0
Pod documented
13  
14 $self->debug(
15 RELAYCLIENT => ( defined $ENV{TCPREMOTEHOST} && "$ENV{TCPREMOTEHOST} " )
16 . "[$ENV{TCPREMOTEIP}]" )
17 0 ▶ if exists $ENV{RELAYCLIENT};
Branch: 1 branch
BranchTrueFalseTotal
if exists $ENV{"RELAYCLIENT"} 0 0 0
Condition0%0/2
defined $ENV{'TCPREMOTEHOST'} && "$ENV{'TCPREMOTEHOST'} "
!ll
00
MC/DC0%0/1
defined $ENV{'TCPREMOTEHOST'} && "$ENV{'TCPREMOTEHOST'} "
defined $ENV{'TCPREMOTEHOST'}
Truth table0%0/2
A
A= defined $ENV{'TCPREMOTEHOST'}
Aresult
00
11
18 0 my $message = $self->message;
19 0 ▶ $self->debug( 'RFC5321.MailFrom' => $message->from || '<>' );
Condition0%0/2
$message->from || '<>'
l!l
00
MC/DC0%0/1
$message->from || '<>'
$message->from
Truth table0%0/2
A
A= $message->from
Aresult
11
00
20 0 $self->debug( to => join ', ', $message->to );
21 }
22  
23 1 1;
24  
25 __END__
26  
27 =head1 NAME
28  
29 Mail::Qmail::Filter::LogEnvelope -
30 log envelope data
31  
32 =head1 SYNOPSIS
33  
34 use Mail::Qmail::Filter;
35  
36 Mail::Qmail::Filter->new->add_filter(
37 '::LogEnvelope',
38 )->run;
39  
40 =head1 DESCRIPTION
41  
42 This L<Mail::Qmail::Filter> plugin logs the following items:
43  
44 =over 4
45  
46 =item RELAYCLIENT
47  
48 only if the environmental variable C<RELAYCLIENT> is set:
49 information about C<TCPREMOTEHOST> and C<TCPREMOTEIP>
50  
51 =item RFC5232.MailFrom
52  
53 the envelope sender
54  
55 =item to
56  
57 the recipients of the message
58  
59 =back
60  
61 =head1 SEE ALSO
62  
63 L<Mail::Qmail::Filter/COMMON PARAMETERS FOR ALL FILTERS>
64  
65 =head1 LICENSE AND COPYRIGHT
66  
67 Copyright 2019 Martin Sluka.
68  
69 This module is free software; you can redistribute it and/or modify it
70 under the terms of the the Artistic License (2.0). You may obtain a
71 copy of the full license at:
72  
73 L<http://www.perlfoundation.org/artistic_license_2_0>
74  
75 Any use, modification, and distribution of the Standard or Modified
76 Versions is governed by this Artistic License. By using, modifying or
77 distributing the Package, you accept this license. Do not use, modify,
78 or distribute the Package, if you do not accept this license.
79  
80 If your Modified Version has been derived from a Modified Version made
81 by someone other than you, you are nevertheless required to ensure that
82 your Modified Version complies with the requirements of this license.
83  
84 This license does not grant you the right to use any trademark, service
85 mark, tradename, or logo of the Copyright Holder.
86  
87 This license includes the non-exclusive, worldwide, free-of-charge
88 patent license to make, have made, use, offer to sell, sell, import and
89 otherwise transfer the Package with respect to any patent claims
90 licensable by the Copyright Holder that are necessarily infringed by the
91 Package. If you institute patent litigation (including a cross-claim or
92 counterclaim) against any party alleging that the Package constitutes
93 direct or contributory patent infringement, then this Artistic License
94 to you shall terminate on the date that such litigation is filed.
95  
96 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
97 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
98 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
99 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
100 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
101 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
102 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
103 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104  
105 =cut
« Mail/Qmail/Filter/Dump.pm ↑ Summary Mail/Qmail/Filter/RewriteFrom.pm »