Saftpresse/Plugin/Postfix/Recieved.pm

filter: Statementstmt 21.0% 8 / 38 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 2 totaltotal 15.6% 10 / 64 SCAR 38.6
CC
8
Cov
15%
process_recieved
72.0
incr_per_time_one
2.0
BEGIN
1.0
CRAP 47.6
« Saftpresse/Plugin/GraphitLineFormat.pm ↑ Summary Saftpresse/Counters.pm »
1 package Log::Saftpresse::Plugin::Postfix::Recieved;
2  
3 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: plugin to gather postfix recieved messages statistics
6 1 our $VERSION = '1.5'; # VERSION
7  
8 1 ▶use Log::Saftpresse::Plugin::Postfix::Utils qw( postfix_remote );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub process_recieved {
11 0 ▶ my ( $self, $stash, $notes ) = @_;
Subroutine process_recieved: not called CC=8 SCAR=42.8
Pod undocumented
12 0 my $service = $stash->{'service'};
13 0 my $message = $stash->{'message'};
14 0 my $qid = $stash->{'queue_id'};
15  
16 0 ▶ if( $service eq 'smtpd' &&
Branch: 2 branches
BranchTrueFalseTotal
if ($service eq 'smtpd' and $message =~ /client=(.+?)(,|$)/) { } 0 0 0
elsif ($service eq 'pickup' and $message =~ /(sender|uid)=/) { } 0 0 0
Condition0%0/3
$service eq "smtpd" and $message =~ /client=(.+?)(,|$)/
!ll&&!rl&&r
000
MC/DC0%0/2
$service eq "smtpd" and $message =~ /client=(.+?)(,|$)/
$service eq "smtpd" $message =~ /client=(.+?)(,|$)/
Truth table0%0/3
A and B
A= $service eq "smtpd"B= $message =~ /client=(.+?)(,|$)/
ABresult
0X0
100
111
17 $message =~ /client=(.+?)(,|$)/ ) {
18 0 my ( $host, $addr ) = postfix_remote( $1 );
19 0 $stash->{'client_host'} = $host;
20 0 $stash->{'client_ip'} = $addr;
21 0 $self->incr_host_one( $stash, 'incoming', 'total');
22 0 ▶ if( $self->saftsumm_mode ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->saftsumm_mode) 0 0 0
23 0 $self->incr_per_time_one( $stash );
24 }
25 0 $notes->set('client-'.$qid => $host);
26 0 ▶ if( $message =~ /orig_queue_id=(.+?)(,|$)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($message =~ /orig_queue_id=(.+?)(,|$)/) 0 0 0
27 0 $stash->{'orig_queue_id'} = $1;
28 0 $self->get_tracking_id('queue_id', $stash, $notes, $1);
29 0 $self->set_tracking_id('pid', $stash, $notes);
30 }
31 0 $self->set_tracking_id('queue_id', $stash, $notes);
32 ▶ } elsif( $service eq 'pickup' &&
Condition0%0/3
$service eq "pickup" and $message =~ /(sender|uid)=/
!ll&&!rl&&r
000
MC/DC0%0/2
$service eq "pickup" and $message =~ /(sender|uid)=/
$service eq "pickup" $message =~ /(sender|uid)=/
Truth table0%0/3
A and B
A= $service eq "pickup"B= $message =~ /(sender|uid)=/
ABresult
0X0
100
111
33 $message =~ /(sender|uid)=/ ) {
34 0 $self->incr_host_one( $stash, 'incoming', 'total');
35 0 ▶ if( $self->saftsumm_mode ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->saftsumm_mode) 0 0 0
36 0 $self->incr_per_time_one( $stash );
37 }
38 0 $notes->set('client-'.$qid => 'pickup');
39 0 $self->set_tracking_id('queue_id', $stash, $notes);
40 }
41  
42 0 return;
43 }
44  
45 sub incr_per_time_one {
46 0 ▶ my ( $self, $stash ) = @_;
Subroutine incr_per_time_one: not called CC=1 SCAR=6.9
Pod undocumented
47 0 my $time = $stash->{'time'};
48 0 $self->incr_host_one( $stash, 'incoming', 'per_hr', $time->hour );
49 0 $self->incr_host_one( $stash, 'incoming', 'per_mday', $time->mday );
50 0 $self->incr_host_one( $stash, 'incoming', 'per_wday', $time->wday );
51 0 $self->incr_host_one( $stash, 'incoming', 'per_day', $time->ymd );
52 0 return;
53 }
54  
55 1 1;
56  
57 __END__
58  
59 =pod
60  
61 =encoding UTF-8
62  
63 =head1 NAME
64  
65 Log::Saftpresse::Plugin::Postfix::Recieved - plugin to gather postfix recieved messages statistics
66  
67 =head1 VERSION
68  
69 version 1.5
70  
71 =head1 AUTHOR
72  
73 Markus Benning <ich@markusbenning.de>
74  
75 =head1 COPYRIGHT AND LICENSE
76  
77 This software is Copyright (c) 1998 by James S. Seymour, 2015 by Markus Benning.
78  
79 This is free software, licensed under:
80  
81 The GNU General Public License, Version 2, June 1991
82  
83 =cut
« Saftpresse/Plugin/GraphitLineFormat.pm ↑ Summary Saftpresse/Counters.pm »