Saftpresse/Plugin/LinuxNetfilter.pm

filter: Statementstmt 33.3% 7 / 21 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 1 / 2 Podpod 100% 1 / 1 totaltotal 22.5% 9 / 40 SCAR 31.6
CC
6
Cov
21%
process
42.0
BEGIN
1.0
CRAP 23.6
« Saftpresse/Utils.pm ↑ Summary Saftpresse/Plugin/PostfixGeoStats.pm »
1 package Log::Saftpresse::Plugin::LinuxNetfilter;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: plugin to parse network packets logged by linux/netfilter
6 1 our $VERSION = '1.5'; # VERSION
7  
8 1 extends 'Log::Saftpresse::Plugin';
9  
10 1 with 'Log::Saftpresse::Plugin::Role::CounterUtils';
11  
12 sub process {
13 0 ▶ my ( $self, $stash ) = @_;
Subroutine process: not called CC=6 SCAR=37.4
Pod documented
14 0 my $program = $stash->{'program'};
15 0 ▶ if( ! defined $program || $program ne 'kernel' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $program or $program ne "kernel") 0 0 0
Condition0%0/3
not defined $program or $program ne "kernel"
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $program or $program ne "kernel"
not defined $program $program ne "kernel"
Truth table0%0/3
not(A) or B
A= not defined $programB= $program ne "kernel"
ABresult
1X1
011
000
16 0 return;
17 }
18  
19 my ( $prefix, $msg ) =
20 0 $stash->{'message'} =~ /^\[\d+\.\d+\] ([^:]+): (IN=\S* OUT=\S* .+) ?$/;
21  
22 0 ▶ if( ! defined $prefix ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $prefix) 0 0 0
23 0 return;
24 }
25  
26 my %values = map {
27 0 my ( $key, $value ) = split('=', $_, 2);
28 0 ▶ defined $value && $value ne '' ? ( lc($key) => $value ) : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $value && $value ne '' ? : 0 0 0
Condition0%0/3
defined $value and $value ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $value and $value ne ""
defined $value $value ne ""
Truth table0%0/3
A and B
A= defined $valueB= $value ne ""
ABresult
0X0
100
111
29 } split(' ', $msg);
30  
31 0 $stash->{'prefix'} = $prefix;
32 0 @$stash{ keys %values } = values %values;
33  
34 0 $self->count_fields_occur( $stash, 'prefix' );
35  
36 0 return;
37 }
38  
39 1 1;
40  
41 __END__
42  
43 =pod
44  
45 =encoding UTF-8
46  
47 =head1 NAME
48  
49 Log::Saftpresse::Plugin::LinuxNetfilter - plugin to parse network packets logged by linux/netfilter
50  
51 =head1 VERSION
52  
53 version 1.5
54  
55 =head1 AUTHOR
56  
57 Markus Benning <ich@markusbenning.de>
58  
59 =head1 COPYRIGHT AND LICENSE
60  
61 This software is Copyright (c) 1998 by James S. Seymour, 2015 by Markus Benning.
62  
63 This is free software, licensed under:
64  
65 The GNU General Public License, Version 2, June 1991
66  
67 =cut
« Saftpresse/Utils.pm ↑ Summary Saftpresse/Plugin/PostfixGeoStats.pm »