blib/lib/ASNMTAP/Asnmtap/Plugins/Mail.pm

filter: Statementstmt 17.6% 88 / 498 Branchbran 1.8% 7 / 376 Conditioncond 2.2% 1 / 45 MC/DCmcdc 0.0% 0 / 25 Subroutinesub 89.2% 25 / 28 Podpod 33.3% 1 / 3 totaltotal 12.5% 122 / 975 CC 206 SCAR 91.5
CC
206
Cov
10%
receiving_fingerprint_mails
15744.9
new
986.4
_init
421.1
CRAP 9400.6
↑ Summary blib/lib/ASNMTAP/Asnmtap/Plugins/Modem.pm »
1 # ----------------------------------------------------------------------------------------------------------
2 # © Copyright 2000-2011 by Alex Peeters [alex.peeters@citap.be]
3 # ----------------------------------------------------------------------------------------------------------
4 # 2011/mm/dd, v3.002.003, package ASNMTAP::Asnmtap::Plugins::Mail Object-Oriented Perl
5 # ----------------------------------------------------------------------------------------------------------
6  
7 # Class name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8 package ASNMTAP::Asnmtap::Plugins::Mail;
9  
10 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11  
12 17 ▶use Carp qw(carp cluck);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15  
16 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 17 ▶use warnings; # Must be used in test mode only. This reduces a little process speed
Subroutine BEGIN: called CC=1 SCAR=0.0
18 #use diagnostics; # Must be used in test mode only. This reduces a lot of process speed
19  
20 17 ▶no warnings 'deprecated';
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
23  
24 17 ▶use ASNMTAP::Asnmtap qw(:_HIDDEN %ERRORS %TYPE);
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27  
28 17 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
29 17 ▶ use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 17 @ASNMTAP::Asnmtap::Plugins::Mail::ISA = qw(Exporter);
32  
33 17 %ASNMTAP::Asnmtap::Plugins::Mail::EXPORT_TAGS = ( ALL => [ qw() ] );
34  
35 17 @ASNMTAP::Asnmtap::Plugins::Mail::EXPORT_OK = ( @{ $ASNMTAP::Asnmtap::Plugins::Mail::EXPORT_TAGS{ALL} } );
36  
37 17 $ASNMTAP::Asnmtap::Plugins::Mail::VERSION = do { my @r = (q$Revision: 3.002.003$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
38 }
39  
40 # Constructor & initialisation - - - - - - - - - - - - - - - - - - - - -
41  
42 1 ▶sub new (@) {
Subroutine new: called CC=40 SCAR=68.9
Pod undocumented
43 1 my $classname = shift;
44  
45 0 ▶ unless ( defined $classname ) { my @c = caller; die "Syntax error: Class name expected after new at $c[1] line $c[2]\n" }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $classname) 0 1 1
46 0 ▶ if ( ref $classname) { my @c = caller; die "Syntax error: Can't construct new ".ref($classname)." from another object at $c[1] line $c[2]\n" }
Branch: 1 branch
BranchTrueFalseTotal
if (ref $classname) 0 1 1
47  
48 1 my $self = {};
49  
50 1 my @parameters = (_asnmtapInherited => undef,
51 _SMTP =>
52 {
53 smtp => 'localhost',
54 port => 25,
55 retries => 3,
56 delay => 1,
57 mime => 0,
58 tz => undef,
59 debug => 0
60 },
61 _IMAP4 =>
62 {
63 imap4 => undef,
64 port => 143,
65 username => undef,
66 password => undef,
67 timeout => 120,
68 debug => 0
69 },
70 _POP3 =>
71 {
72 pop3 => undef,
73 port => 110,
74 username => undef,
75 password => undef,
76 timeout => 120,
77 debug => 0
78 },
79 _mailType => 0,
80 _text =>
81 {
82 SUBJECT => 'uKey=ASNMTAP',
83 from => 'From:',
84 to => 'To:',
85 subject => 'Subject:',
86 status => 'Status'
87 },
88 _mail =>
89 {
90 from => undef,
91 to => undef,
92 status => undef,
93 body => undef
94 }
95 );
96  
97 1 ▶ if ( $] < 5.010000 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.01) { } 0 1 1
98 0 eval "use fields";
99 0 $self = fields::phash (@parameters);
100 } else {
101 17 ▶ use ASNMTAP::PseudoHash;
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 1 $self = do {
104 1 my @array = undef;
105  
106 1 ▶ while (my ($k, $v) = splice(@parameters, 0, 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@parameters, 0, 2)) 7 1 8
107 7 $array[$array[0]{$k} = @array] = $v;
108 }
109  
110 1 bless(\@array, $classname);
111 };
112 }
113  
114 1 my %args = @_;
115  
116 1 ▶ $self->{_asnmtapInherited} = $args{_asnmtapInherited} if ( exists $args{_asnmtapInherited} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_asnmtapInherited"} 1 0 1
117  
118 0 ▶ if ( exists $args{_SMTP} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"_SMTP"}) 0 0 0
119 0 ▶ $self->{_SMTP}->{smtp} = $args{_SMTP}->{smtp} if ( exists $args{_SMTP}->{smtp} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_SMTP"}{"smtp"} 0 0 0
120 0 ▶ $self->{_SMTP}->{port} = $args{_SMTP}->{port} if ( exists $args{_SMTP}->{port} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_SMTP"}{"port"} 0 0 0
121 0 ▶ $self->{_SMTP}->{retries} = $args{_SMTP}->{retries} if ( exists $args{_SMTP}->{retries} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_SMTP"}{"retries"} 0 0 0
122 0 ▶ $self->{_SMTP}->{delay} = $args{_SMTP}->{delay} if ( exists $args{_SMTP}->{delay} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_SMTP"}{"delay"} 0 0 0
123 0 ▶ $self->{_SMTP}->{mime} = $args{_SMTP}->{mime} if ( exists $args{_SMTP}->{mime} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_SMTP"}{"mime"} 0 0 0
124 0 ▶ $self->{_SMTP}->{tz} = $args{_SMTP}->{tz} if ( exists $args{_SMTP}->{tz} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_SMTP"}{"tz"} 0 0 0
125 0 ▶ $self->{_SMTP}->{debug} = $args{_SMTP}->{debug} if ( exists $args{_SMTP}->{debug} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_SMTP"}{"debug"} 0 0 0
126 }
127  
128 0 ▶ if ( exists $args{_IMAP4} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"_IMAP4"}) 0 0 0
129 0 ▶ $self->{_IMAP4}->{imap4} = $args{_IMAP4}->{imap4} if ( exists $args{_IMAP4}->{imap4} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_IMAP4"}{"imap4"} 0 0 0
130 0 ▶ $self->{_IMAP4}->{port} = $args{_IMAP4}->{port} if ( exists $args{_IMAP4}->{port} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_IMAP4"}{"port"} 0 0 0
131 0 ▶ $self->{_IMAP4}->{username} = $args{_IMAP4}->{username} if ( exists $args{_IMAP4}->{username} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_IMAP4"}{"username"} 0 0 0
132 0 ▶ $self->{_IMAP4}->{password} = $args{_IMAP4}->{password} if ( exists $args{_IMAP4}->{password} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_IMAP4"}{"password"} 0 0 0
133 0 ▶ $self->{_IMAP4}->{timeout} = $args{_IMAP4}->{timeout} if ( exists $args{_IMAP4}->{timeout} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_IMAP4"}{"timeout"} 0 0 0
134 0 ▶ $self->{_IMAP4}->{debug} = $args{_IMAP4}->{debug} if ( exists $args{_IMAP4}->{debug} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_IMAP4"}{"debug"} 0 0 0
135 }
136  
137 0 ▶ if ( exists $args{_POP3} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"_POP3"}) 0 0 0
138 0 ▶ $self->{_POP3}->{pop3} = $args{_POP3}->{pop3} if ( exists $args{_POP3}->{pop3} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_POP3"}{"pop3"} 0 0 0
139 0 ▶ $self->{_POP3}->{port} = $args{_POP3}->{port} if ( exists $args{_POP3}->{port} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_POP3"}{"port"} 0 0 0
140 0 ▶ $self->{_POP3}->{username} = $args{_POP3}->{username} if ( exists $args{_POP3}->{username} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_POP3"}{"username"} 0 0 0
141 0 ▶ $self->{_POP3}->{password} = $args{_POP3}->{password} if ( exists $args{_POP3}->{password} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_POP3"}{"password"} 0 0 0
142 0 ▶ $self->{_POP3}->{timeout} = $args{_POP3}->{timeout} if ( exists $args{_POP3}->{timeout} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_POP3"}{"timeout"} 0 0 0
143 0 ▶ $self->{_POP3}->{debug} = $args{_POP3}->{debug} if ( exists $args{_POP3}->{debug} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_POP3"}{"debug"} 0 0 0
144 }
145  
146 0 ▶ $self->{_mailType} = $args{_mailType} if ( exists $args{_mailType} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_mailType"} 0 0 0
147  
148 0 ▶ if ( exists $args{_text} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"_text"}) 0 0 0
149 0 ▶ $self->{_text}->{SUBJECT} = $args{_text}->{SUBJECT} if ( exists $args{_text}->{SUBJECT} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_text"}{"SUBJECT"} 0 0 0
150 0 ▶ $self->{_text}->{from} = $args{_text}->{from} if ( exists $args{_text}->{from} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_text"}{"from"} 0 0 0
151 0 ▶ $self->{_text}->{to} = $args{_text}->{to} if ( exists $args{_text}->{to} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_text"}{"to"} 0 0 0
152 0 ▶ $self->{_text}->{subject} = $args{_text}->{subject} if ( exists $args{_text}->{subject} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_text"}{"subject"} 0 0 0
153 0 ▶ $self->{_text}->{status} = $args{_text}->{status} if ( exists $args{_text}->{status} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_text"}{"status"} 0 0 0
154 }
155  
156 0 ▶ if ( exists $args{_mail} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"_mail"}) 0 0 0
157 0 ▶ $self->{_mail}->{from} = $args{_mail}->{from} if ( exists $args{_mail}->{from} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_mail"}{"from"} 0 0 0
158 0 ▶ $self->{_mail}->{to} = $args{_mail}->{to} if ( exists $args{_mail}->{to} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_mail"}{"to"} 0 0 0
159 0 ▶ $self->{_mail}->{status} = $args{_mail}->{status} if ( exists $args{_mail}->{status} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_mail"}{"status"} 0 0 0
160 0 ▶ $self->{_mail}->{body} = $args{_mail}->{body} if ( exists $args{_mail}->{body} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"_mail"}{"body"} 0 0 0
161 }
162  
163 0 bless ($self, $classname);
164 0 $self->_init();
165 0 return ($self);
166 }
167  
168 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
169  
170 0 ▶sub _init {
Subroutine _init: not called CC=21 SCAR=60.4
171 0 my $asnmtapInherited = $_[0]->{_asnmtapInherited};
172 0 ▶ unless ( defined $asnmtapInherited ) { cluck ( 'ASNMTAP::Asnmtap::Plugins::Mail: asnmtapInherited missing' ); exit $ERRORS{UNKNOWN} }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $asnmtapInherited) 0 0 0
173  
174 0 ▶ carp ('ASNMTAP::Asnmtap::Pluginw::MAIL: _init') if ( $$asnmtapInherited->{_debug} );
Branch: 1 branch
BranchTrueFalseTotal
if $$asnmtapInherited->{"_debug"} 0 0 0
175  
176 0 ▶ unless ( defined $$asnmtapInherited->{_programName} and $$asnmtapInherited->{_programName} ne 'NOT DEFINED' ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $$asnmtapInherited->{"_programName"} and $$asnmtapInherited->{"_programName"} ne "NOT DEFINED") 0 0 0
Condition0%0/3
defined $$asnmtapInherited->{"_programName"} and $$asnmtapInherited->{"_programName"} ne "NOT DEFINED"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $$asnmtapInherited->{"_programName"} and $$asnmtapInherited->{"_programName"} ne "NOT DEFINED"
defined $$asnmtapInherited->{"_programName"} $$asnmtapInherited->{"_programName"} ne "NOT DEFINED"
Truth table0%0/3
A and B
A= defined $$asnmtapInherited->{"_programName"}B= $$asnmtapInherited->{"_programName"} ne "NOT DEFINED"
ABresult
0X0
100
111
177 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing parent object attribute mName' }, $TYPE{APPEND} );
178 0 return ( $ERRORS{UNKNOWN} );
179 }
180  
181 0 ▶ unless ( defined $$asnmtapInherited->{_programDescription} and $$asnmtapInherited->{_programDescription} ne 'NOT DEFINED' ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $$asnmtapInherited->{"_programDescription"} and $$asnmtapInherited->{"_programDescription"} ne "NOT DEFINED") 0 0 0
Condition0%0/3
defined $$asnmtapInherited->{"_programDescription"} and $$asnmtapInherited->{"_programDescription"} ne "NOT DEFINED"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $$asnmtapInherited->{"_programDescription"} and $$asnmtapInherited->{"_programDescription"} ne "NOT DEFINED"
defined $$asnmtapInherited->{"_programDescription"} $$asnmtapInherited->{"_programDescription"} ne "NOT DEFINED"
Truth table0%0/3
A and B
A= defined $$asnmtapInherited->{"_programDescription"}B= $$asnmtapInherited->{"_programDescription"} ne "NOT DEFINED"
ABresult
0X0
100
111
182 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing parent object attribute mDescription' }, $TYPE{APPEND} );
183 0 return ( $ERRORS{UNKNOWN} );
184 }
185  
186 0 ▶ unless ( $$asnmtapInherited->getOptionsArgv('environment') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$asnmtapInherited->getOptionsArgv("environment")) 0 0 0
187 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing parent object command line option -e|--environment' }, $TYPE{APPEND} );
188 0 return ( $ERRORS{UNKNOWN} );
189 }
190  
191 0 my %environment = ( P => 'PROD', S => 'SIM', A => 'ACC', T => 'TEST', D => 'DEV', L => 'LOCAL' );
192 0 $_[0]->[ $_[0]->[0]{_environment_} = @{$_[0]} ] = $environment { $$asnmtapInherited->getOptionsArgv('environment') };
193  
194 0 ▶ if ( $$asnmtapInherited->getOptionsValue ('debug') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$asnmtapInherited->getOptionsValue("debug")) 0 0 0
195 0 ▶ $_[0]->{_SMTP}->{debug} = $$asnmtapInherited->getOptionsValue ('debug') if ( $_[0]->{_SMTP}->{debug} < $$asnmtapInherited->getOptionsValue ('debug') );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_SMTP"}{"debug"} < $$asnmtapInherited->getOptionsValue("debug") 0 0 0
196 0 ▶ $_[0]->{_POP3}->{debug} = $$asnmtapInherited->getOptionsValue ('debug') if ( $_[0]->{_POP3}->{debug} < $$asnmtapInherited->getOptionsValue ('debug') );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_POP3"}{"debug"} < $$asnmtapInherited->getOptionsValue("debug") 0 0 0
197 0 ▶ $_[0]->{_IMAP4}->{debug} = $$asnmtapInherited->getOptionsValue ('debug') if ( $_[0]->{_IMAP4}->{debug} < $$asnmtapInherited->getOptionsValue ('debug') );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_IMAP4"}{"debug"} < $$asnmtapInherited->getOptionsValue("debug") 0 0 0
198 }
199  
200 0 ▶ $_[0]->{_POP3}->{timeout} = $$asnmtapInherited->timeout() if ( $_[0]->{_POP3}->{timeout} == 120 );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_POP3"}{"timeout"} == 120 0 0 0
201  
202 0 ▶ $_[0]->{_IMAP4}->{timeout} = $$asnmtapInherited->timeout() if ( $_[0]->{_IMAP4}->{timeout} == 120 );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"_IMAP4"}{"timeout"} == 120 0 0 0
203  
204 0 ▶ unless ($_[0]->{_mailType} =~ /^[01]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[0]{"_mailType"} =~ /^[01]$/) 0 0 0
205 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Parameter _mailType must be 0 or 1' }, $TYPE{APPEND} );
206 0 return ( $ERRORS{UNKNOWN} );
207 }
208  
209 0 ▶ unless ( defined $_[0]->{_mail}->{from} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $_[0]{"_mail"}{"from"}) 0 0 0
210 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing MAIL parameter _mail => {from => ...}' }, $TYPE{APPEND} );
211 0 return ( $ERRORS{UNKNOWN} );
212 }
213  
214 0 ▶ unless ( defined $_[0]->{_mail}->{to} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $_[0]{"_mail"}{"to"}) 0 0 0
215 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing MAIL parameter _mail => {to => ...}' }, $TYPE{APPEND} );
216 0 return ( $ERRORS{UNKNOWN} );
217 }
218  
219 0 ▶ unless ( defined $_[0]->{_mail}->{status} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $_[0]{"_mail"}{"status"}) 0 0 0
220 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing MAIL parameter _mail => {status => ...}' }, $TYPE{APPEND} );
221 0 return ( $ERRORS{UNKNOWN} );
222 }
223  
224 0 ▶ unless ( defined $_[0]->{_mail}->{body} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $_[0]{"_mail"}{"body"}) 0 0 0
225 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing MAIL parameter _mail => {body => ...}' }, $TYPE{APPEND} );
226 0 return ( $ERRORS{UNKNOWN} );
227 }
228  
229 0 $_[0]->[ $_[0]->[0]{_subject_} = @{$_[0]} ] = $_[0]->{_text}->{SUBJECT} .' / '. $_[0]->{_text}->{from} .' '. $_[0]->{_mail}->{from} .' '. $_[0]->{_text}->{to} .' '. $_[0]->{_mail}->{to};
230  
231 0 ▶ unless ( $_[0]->{_mailType} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[0]{"_mailType"}) 0 0 0
232 0 $_[0]->[ $_[0]->[0]{_branding_} = @{$_[0]} ] = '<'. $$asnmtapInherited->{_programName} .'> <'. $$asnmtapInherited->{_programDescription} .'>';
233 0 $_[0]->[ $_[0]->[0]{_timestamp_} = @{$_[0]} ] = 'Timestamp <'. $_[0]->{_mail}->{from} .'>:';
234 0 $_[0]->[ $_[0]->[0]{_status_} = @{$_[0]} ] = $_[0]->{_text}->{status} .' <'. $_[0]->{_mail}->{status} .'>';
235 }
236  
237 0 ▶ if ( $$asnmtapInherited->{_debug} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$asnmtapInherited->{"_debug"}) 0 0 0
238 17 ▶ use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
239 0 print "\n". ref ($_[0]) .": Now we'll dump data\n\n", Dumper ( $_[0] ), "\n\n";
240 }
241 }
242  
243 # Utility methods - - - - - - - - - - - - - - - - - - - - - - - - - - - -
244  
245 0 ▶sub sending_fingerprint_mail {
Subroutine sending_fingerprint_mail: not called CC=10 SCAR=42.4
Pod documented
246 0 my $self = shift; &_checkAccObjRef ( $self );
247  
248 0 my $asnmtapInherited = $self->{_asnmtapInherited};
249 0 ▶ return ( $$asnmtapInherited->pluginValue ('stateValue') ) unless ( exists $self->{_subject_} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"_subject_"} 0 0 0
250  
251 0 my %defaults = ( perfdataLabel => undef );
252 0 my %parms = (%defaults, @_);
253  
254 0 ▶ $$asnmtapInherited->setEndTime_and_getResponsTime ( $$asnmtapInherited->pluginValue ('endTime') ) if ( defined $parms{perfdataLabel} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $parms{"perfdataLabel"} 0 0 0
255  
256 17 ▶ use Mail::Sendmail qw(sendmail %mailcfg);
Subroutine BEGIN: called CC=1 SCAR=0.0
257 0 $mailcfg {smtp} = $self->{_SMTP}->{smtp};
258 0 $mailcfg {port} = $self->{_SMTP}->{port};
259 0 $mailcfg {retries} = $self->{_SMTP}->{retries};
260 0 $mailcfg {delay} = $self->{_SMTP}->{delay};
261 0 $mailcfg {mime} = $self->{_SMTP}->{mime};
262 0 ▶ $mailcfg {tz} = $self->{_SMTP}->{tx} if ( defined $self->{_SMTP}->{tx} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"_SMTP"}{"tx"} 0 0 0
263 0 $mailcfg {debug} = $$asnmtapInherited->getOptionsValue ('debug');
264  
265 0 my $message;
266  
267 0 ▶ if ( $self->{_mailType} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_mailType'}) { } 0 0 0
268 17 ▶ use Time::Local;
Subroutine BEGIN: called CC=1 SCAR=0.0
269 0 my ($localYear, $localMonth, $currentYear, $currentMonth, $currentDay, $currentHour, $currentMin, $currentSec) = ((localtime)[5], (localtime)[4], ((localtime)[5] + 1900), ((localtime)[4] + 1), (localtime)[3,2,1,0]);
270 0 my $mailEpochtime = timelocal($currentSec, $currentMin, $currentHour, $currentDay, $localMonth, $localYear);
271 0 $message = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE FingerprintEmail SYSTEM \"dtd/FingerprintEmail-1.0.dtd\"><FingerprintEmail><Schema Value=\"1.0\"/><Fingerprint From=\"". $self->{_mail}->{from} ."\" To=\"". $self->{_mail}->{to} ."\" Destination=\"ASNMTAP\" Plugin=\"". $$asnmtapInherited->{_programName} ."\" Description=\"". $$asnmtapInherited->{_programDescription} ."\" Environment=\"". $self->{_environment_} ."\" Date=\"$currentYear/$currentMonth/$currentDay\" Time=\"$currentHour:$currentMin:$currentSec\" Epochtime=\"$mailEpochtime\" Status=\"". $self->{_mail}->{status} ."\" /></FingerprintEmail>\n";
272 } else {
273 17 ▶ use ASNMTAP::Time qw(&get_datetimeSignal);
Subroutine BEGIN: called CC=1 SCAR=0.0
274 0 $message = $self->{_subject_} ."\n". $self->{_branding_} ."\n". $self->{_timestamp_} .' '. get_datetimeSignal() ."\n". $self->{_status_} ."\n";
275 }
276  
277 0 $message .= $self->{_mail}->{body} ."\n";
278 0 my %mail = ( To => $self->{_mail}->{to}, From => $self->{_mail}->{from}, Subject => $self->{_subject_}, Message => $message );
279  
280 0 ▶ my $returnCode = (sendmail %mail) ? $ERRORS{OK} : $ERRORS{CRITICAL};
Branch: 1 branch
BranchTrueFalseTotal
sendmail(%mail) ? : 0 0 0
281 0 ▶ $$asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => ( defined $parms{perfdataLabel} ? $parms{perfdataLabel} : 'email send' ) . ( $returnCode ? ' failed' : '' ) }, $TYPE{APPEND} );
Branch: 2 branches
BranchTrueFalseTotal
defined $parms{'perfdataLabel'} ? : 0 0 0
$returnCode ? : 0 0 0
282  
283 0 ▶ if ( defined $parms{perfdataLabel} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $parms{"perfdataLabel"}) 0 0 0
284 0 my $responseTime = $$asnmtapInherited->setEndTime_and_getResponsTime ( $$asnmtapInherited->pluginValue ('endTime') );
285 0 $$asnmtapInherited->appendPerformanceData ( "'". $parms{perfdataLabel} ."'=". $responseTime .'ms;;;;' );
286 }
287  
288 0 ▶ print "\$Mail::Sendmail::log says:\n", $Mail::Sendmail::log, "\n" if ( $$asnmtapInherited->getOptionsValue ('debug') );
Branch: 1 branch
BranchTrueFalseTotal
if $$asnmtapInherited->getOptionsValue("debug") 0 0 0
289 0 return ( $returnCode );
290 }
291  
292 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
293  
294 0 ▶sub receiving_fingerprint_mails {
Subroutine receiving_fingerprint_mails: not called CC=136 SCAR=96.6
Pod undocumented
295 0 my $self = shift; &_checkAccObjRef ( $self );
296  
297 0 my $asnmtapInherited = $self->{_asnmtapInherited};
298 0 ▶ return ( $$asnmtapInherited->pluginValue ('stateValue') ) unless ( exists $self->{_subject_} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"_subject_"} 0 0 0
299  
300 0 my %defaults = ( custom => undef,
301 customArguments => undef,
302 checkFingerprint => 1,
303 receivedState => 0,
304 outOfDate => undef,
305 perfdataLabel => undef
306 );
307
308 0 my %parms = (%defaults, @_);
309  
310 0 ▶ if ( $self->{_mailType} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_mailType"}) 0 0 0
311 0 ▶ unless ( defined $parms{outOfDate} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"outOfDate"}) 0 0 0
312 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing MAIL receiving_fingerprint_mails parameter {outOfDate => ...}' }, $TYPE{APPEND} );
313 0 return ( $ERRORS{UNKNOWN} );
314 }
315 }
316  
317 17 ▶ use ASNMTAP::Asnmtap::Plugins::XML qw(&extract_XML);
Subroutine BEGIN: called CC=1 SCAR=0.0
318  
319 0 $self->[ $self->[0]{defaultArguments} = @{$self} ] = { date => undef, day => undef, month => undef, year => undef, time => undef, hour => undef, min => undef, sec => undef, numberOfMatches => undef, result => undef };
320  
321 0 ▶ unless ($parms{checkFingerprint} =~ /^[01]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parms{"checkFingerprint"} =~ /^[01]$/) 0 0 0
322 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Parameter checkFingerprint must be 0 or 1' }, $TYPE{APPEND} );
323 0 return ( $ERRORS{UNKNOWN} );
324 }
325  
326 0 ▶ unless ($parms{receivedState} =~ /^[01]$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parms{"receivedState"} =~ /^[01]$/) 0 0 0
327 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Parameter receivedState must be 0 or 1' }, $TYPE{APPEND} );
328 0 return ( $ERRORS{UNKNOWN} );
329 }
330  
331 0 my ($numberOfMails, $email);
332  
333 0 ▶ if ( defined $self->{_IMAP4}->{imap4} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->{'_IMAP4'}{'imap4'}) { } 0 0 0
elsif (defined $self->{'_POP3'}{'pop3'}) { } 0 0 0
334 0 ▶ unless ( defined $self->{_IMAP4}->{username} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_IMAP4"}{"username"}) 0 0 0
335 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing Mail IMAP4 parameter username' }, $TYPE{APPEND} );
336 0 return ( $ERRORS{UNKNOWN} );
337 }
338  
339 0 ▶ unless ( defined $self->{_IMAP4}->{password} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_IMAP4"}{"password"}) 0 0 0
340 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing Mail IMAP4 parameter password' }, $TYPE{APPEND} );
341 0 return ( $ERRORS{UNKNOWN} );
342 }
343  
344 17 ▶ use Net::IMAP::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
345 0 $email = Net::IMAP::Simple->new ( $self->{_IMAP4}->{imap4}, port => $self->{_IMAP4}->{port}, timeout => $self->{_IMAP4}->{timeout} );
346
347 0 ▶ unless ( defined $email ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $email) 0 0 0
348 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => "Cannot connect to IMAP4 server: $self->{_IMAP4}->{imap4}, $Net::IMAP::Simple::errstr" }, $TYPE{APPEND} );
349 0 return ( $ERRORS{UNKNOWN} );
350 }
351
352 0 ▶ unless ( $email->login( $self->{_IMAP4}->{username}, $self->{_IMAP4}->{password} ) ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($email->login($self->{"_IMAP4"}{"username"}, $self->{"_IMAP4"}{"password"})) 0 0 0
353 0 my $errstr = $email->errstr; $errstr =~ s/[\n\r]/ /g; $errstr =~ s/ +$//g;
354 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => "Cannot login to IMAP4 server: $self->{_IMAP4}->{imap4}, $errstr" }, $TYPE{APPEND} );
355 0 return ( $ERRORS{UNKNOWN} );
356 }
357  
358 0 $numberOfMails = $email->select ( 'INBOX' );
359  
360 0 ▶ unless ( defined $numberOfMails ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $numberOfMails) 0 0 0
361 0 my $errstr = $email->errstr; $errstr =~ s/[\n\r]/ /g; $errstr =~ s/ +$//g;
362 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => "Cannot select my INBOX on IMAP4 server: $self->{_IMAP4}->{imap4}, $errstr" }, $TYPE{APPEND} );
363 0 return ( $ERRORS{UNKNOWN} );
364 }
365 } elsif ( defined $self->{_POP3}->{pop3} ) {
366 0 ▶ unless ( defined $self->{_POP3}->{username} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_POP3"}{"username"}) 0 0 0
367 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing Mail POP3 parameter username' }, $TYPE{APPEND} );
368 0 return ( $ERRORS{UNKNOWN} );
369 }
370  
371 0 ▶ unless ( defined $self->{_POP3}->{password} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_POP3"}{"password"}) 0 0 0
372 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing Mail POP3 parameter password' }, $TYPE{APPEND} );
373 0 return ( $ERRORS{UNKNOWN} );
374 }
375  
376 17 ▶ use Mail::POP3Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
377 0 $email = Mail::POP3Client->new ( HOST => $self->{_POP3}->{pop3}, PORT => $self->{_POP3}->{port}, USER => $self->{_POP3}->{username}, PASSWORD => $self->{_POP3}->{password}, TIMEOUT => $self->{_POP3}->{timeout} ); # , DEBUG => ( $self->{_POP3}->{debug} >= 3 ? 1 : 0 ) );
378  
379 0 $numberOfMails = $email->Count();
380  
381 0 ▶ unless ( defined $numberOfMails and $numberOfMails != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $numberOfMails and $numberOfMails != -1) 0 0 0
Condition0%0/3
defined $numberOfMails and $numberOfMails != -1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $numberOfMails and $numberOfMails != -1
defined $numberOfMails $numberOfMails != -1
Truth table0%0/3
A and B
A= defined $numberOfMailsB= $numberOfMails != -1
ABresult
0X0
100
111
382 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => "Cannot connect/login to POP3 server: $self->{_POP3}->{pop3}" }, $TYPE{APPEND} );
383 0 return ( $ERRORS{UNKNOWN} );
384 }
385 } else {
386 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'NO EMAIL CLIENT SPECIFIED !!!' }, $TYPE{APPEND} );
387 0 return ( $ERRORS{UNKNOWN} );
388 }
389
390 0 ▶ if ( defined $numberOfMails ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $numberOfMails) 0 0 0
391 0 my $returnCode = $ERRORS{DEPENDENT};
392 0 $self->{defaultArguments}->{numberOfMatches} = 0;
393  
394 0 ▶ if ( $numberOfMails ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($numberOfMails) 0 0 0
395 17 ▶ use MIME::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
396 0 my $parser = new MIME::Parser;
397 0 $parser->output_to_core(1);
398 0 $parser->decode_bodies(1);
399  
400 17 ▶ use constant HEADER => '<?xml version="1.0" encoding="UTF-8"?>';
Subroutine BEGIN: called CC=1 SCAR=0.0
401 17 ▶ use constant SYSTEM => 'dtd/FingerprintEmail-1.0.dtd';
Subroutine BEGIN: called CC=1 SCAR=0.0
402 17 ▶ use constant FOOTER => '</FingerprintEmail>';
Subroutine BEGIN: called CC=1 SCAR=0.0
403 0 my $fingerprintXML = HEADER .'<!DOCTYPE FingerprintEmail SYSTEM "'. SYSTEM .'"><FingerprintEmail>';
404  
405 0 my $debug = $$asnmtapInherited->getOptionsValue ('debug');
406 0 my $label;
407  
408 0 ▶ for( my $msgnum = 1; $msgnum <= $numberOfMails; $msgnum++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgnum <= $numberOfMails) 0 0 0
409 0 ▶ print "\n", ref ($self), "::receiving_fingerprint_mails(): message number $msgnum\n" if ( $debug );
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
410 0 my ($fromNotFound, $toNotFound, $subjectNotFound, $fingerprintFound) = (1, 1, 1, 3);
411 0 my ($messageNotFound, $brandingNotFound, $timestampNotFound, $statusNotFound, $xmlNotFound) = (0, 0, 0, 0, 0);
412  
413 0 ▶ if ( $parms{checkFingerprint} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parms{"checkFingerprint"}) 0 0 0
414 0 $statusNotFound = 1;
415  
416 0 ▶ if ( $self->{_mailType} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_mailType'}) { } 0 0 0
417 0 ($xmlNotFound, $fingerprintFound) = (1, $fingerprintFound + 2);
418 } else {
419 0 ($messageNotFound, $brandingNotFound, $timestampNotFound, $fingerprintFound) = (1, 1, 1, $fingerprintFound + 4);
420 }
421 }
422  
423 0 $self->{defaultArguments}->{result} = '';
424  
425 0 my $msgbuffer;
426  
427 0 ▶ if ( defined $self->{_IMAP4}->{imap4} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->{'_IMAP4'}{'imap4'}) { } 0 0 0
elsif (defined $self->{'_POP3'}{'pop3'}) { } 0 0 0
428 0 $msgbuffer = $email->top ( $msgnum );
429 } elsif ( defined $self->{_POP3}->{pop3} ) {
430 0 $msgbuffer = $email->Head ( $msgnum );
431 }
432  
433 0 my $entity = $parser->parse_data( $msgbuffer );
434 0 my $head = $entity->head;
435 0 $head->unfold;
436  
437 0 ▶ if ( $debug >= 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug >= 2) 0 0 0
438 0 print ref ($self), "::receiving_fingerprint_mails(): Header\n", $head->stringify, "\n\n";
439 0 print ref ($self), "::receiving_fingerprint_mails(): MIME-Version: ", $head->get ('MIME-Version'), "\n";
440 0 print ref ($self), "::receiving_fingerprint_mails(): MIME-Type: ", $head->mime_type, "\n";
441 0 print ref ($self), "::receiving_fingerprint_mails(): MIME-Encoding: ", $head->mime_encoding, "\n";
442 0 ▶ print ref ($self), "::receiving_fingerprint_mails(): Content-Type Charset: ", $head->mime_attr ('content-type.charset'), "\n"if ( $head->mime_attr('content-type.charset') );
Branch: 1 branch
BranchTrueFalseTotal
if $head->mime_attr("content-type.charset") 0 0 0
443 0 ▶ print ref ($self), "::receiving_fingerprint_mails(): Content-Type Name: ", $head->mime_attr('content-type.name'), "\n" if ( $head->mime_attr('content-type.name') );
Branch: 1 branch
BranchTrueFalseTotal
if $head->mime_attr("content-type.name") 0 0 0
444 0 ▶ print ref ($self), "::receiving_fingerprint_mails(): Multipart Boundary: ", $head->multipart_boundary, "\n" if ( $head->multipart_boundary );
Branch: 1 branch
BranchTrueFalseTotal
if $head->multipart_boundary 0 0 0
445 }
446  
447 0 ▶ print "\n", ref ($self), "::receiving_fingerprint_mails(): HEAD\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
448  
449 0 foreach my $msgline ( split (/[\n\r]/, $head->stringify) ) {
450 0 ▶ next unless ( $msgline );
Branch: 1 branch
BranchTrueFalseTotal
unless $msgline 0 0 0
451  
452 0 ▶ if ( $fromNotFound ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fromNotFound) 0 0 0
453 0 ▶ if ($msgline =~ /^$self->{_text}->{from}/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgline =~ /^$self->{"_text"}{"from"}/) 0 0 0
454 0 ▶ print "From .... : $msgline\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
455 0 ▶ $fromNotFound = ( $msgline !~ /^$self->{_text}->{from}\s+$self->{_mail}->{from}/ ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
!($msgline =~ /^$self->{'_text'}{'from'}\s+$self->{'_mail'}{'from'}/) ? : 0 0 0
456 0 ▶ my $label = $fromNotFound ? ' (?)' : '(match)';
Branch: 1 branch
BranchTrueFalseTotal
$fromNotFound ? : 0 0 0
457 0 ▶ print " $label : $self->{_text}->{from} $self->{_mail}->{from}\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
458 0 ▶ unless ( $fromNotFound ) { $fingerprintFound--; next; }
Branch: 1 branch
BranchTrueFalseTotal
unless ($fromNotFound) 0 0 0
459 }
460 }
461  
462 0 ▶ if ( $toNotFound ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($toNotFound) 0 0 0
463 0 ▶ if ($msgline =~ /^$self->{_text}->{to}/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgline =~ /^$self->{"_text"}{"to"}/) 0 0 0
464 0 ▶ print "To ...... : $msgline\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
465 0 ▶ $toNotFound = ( $msgline !~ /^$self->{_text}->{to}\s+$self->{_mail}->{to}/ ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
!($msgline =~ /^$self->{'_text'}{'to'}\s+$self->{'_mail'}{'to'}/) ? : 0 0 0
466 0 ▶ my $label = $toNotFound ? ' (?)' : '(match)';
Branch: 1 branch
BranchTrueFalseTotal
$toNotFound ? : 0 0 0
467 0 ▶ print " $label : $self->{_text}->{to} $self->{_mail}->{to}\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
468 0 ▶ unless ( $toNotFound ) { $fingerprintFound--; next; }
Branch: 1 branch
BranchTrueFalseTotal
unless ($toNotFound) 0 0 0
469 }
470 }
471  
472 0 ▶ if ( $subjectNotFound ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($subjectNotFound) 0 0 0
473 0 ▶ if ($msgline =~ /^$self->{_text}->{subject}/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgline =~ /^$self->{"_text"}{"subject"}/) 0 0 0
474 0 ▶ print "Subject . : $msgline\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
475 0 ▶ $subjectNotFound = ( $msgline !~ /^$self->{_text}->{subject}\s+$self->{_subject_}/ ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
!($msgline =~ /^$self->{'_text'}{'subject'}\s+$self->{'_subject_'}/) ? : 0 0 0
476 0 ▶ my $label = $subjectNotFound ? ' (?)' : '(match)';
Branch: 1 branch
BranchTrueFalseTotal
$subjectNotFound ? : 0 0 0
477 0 ▶ print " $label : $self->{_text}->{subject} $self->{_subject_}\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
478 0 ▶ unless ( $subjectNotFound ) { $fingerprintFound--; next; }
Branch: 1 branch
BranchTrueFalseTotal
unless ($subjectNotFound) 0 0 0
479 }
480 }
481 }
482  
483 0 ▶ unless ( $fromNotFound or $toNotFound or $subjectNotFound ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fromNotFound or $toNotFound or $subjectNotFound) 0 0 0
Condition0%0/6
$fromNotFound or $toNotFound or $subjectNotFound
l!l&&r!l&&!r
000
$fromNotFound or $toNotFound
l!l&&r!l&&!r
000
MC/DC0%0/3
$fromNotFound or $toNotFound or $subjectNotFound
$fromNotFound $toNotFound $subjectNotFound
Truth table0%0/4
A or B or C
A= $fromNotFoundB= $toNotFoundC= $subjectNotFound
ABCresult
1XX1
01X1
0011
0000
484 0 ▶ print "\n", ref ($self), "::receiving_fingerprint_mails(): BODY\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
485  
486 0 ▶ if ( defined $self->{_IMAP4}->{imap4} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->{'_IMAP4'}{'imap4'}) { } 0 0 0
elsif (defined $self->{'_POP3'}{'pop3'}) { } 0 0 0
487 17 ▶ use Email::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
488 0 my $mail = Email::Simple->new( join ( '', @{ $email->get ( $msgnum ) } ) );
489 0 $msgbuffer = $mail->body;
490 } elsif ( defined $self->{_POP3}->{pop3} ) {
491 0 $msgbuffer = $email->Body ( $msgnum );
492 }
493  
494 17 ▶ use MIME::Decoder;
Subroutine BEGIN: called CC=1 SCAR=0.0
495  
496 0 ▶ unless ( supported MIME::Decoder $head->mime_encoding ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("MIME::Decoder"->supported($head->mime_encoding)) 0 0 0
497 0 ▶ print "MIME .... : '". $head->mime_encoding ."' encoding is not supported!\n" if ($debug );
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
498 0 $returnCode = $ERRORS{UNKNOWN};
499 0 $$asnmtapInherited->pluginValues ( { stateValue => $returnCode, error => "MIME-Encoding: '". $head->mime_encoding ."' is not supported!" }, $TYPE{APPEND} );
500 0 next;
501 }
502  
503 # if ( $head->mime_encoding eq 'quoted-printable' or $head->mime_encoding eq '7bit' or $head->mime_encoding eq '8bit' ) {
504 0 ▶ if ( $head->mime_encoding eq '7bit' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head->mime_encoding eq '7bit') { } 0 0 0
505 0 $msgbuffer = MIME::QuotedPrint::decode($msgbuffer);
506 } else {
507 17 ▶ use IO::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
508 0 my $ioIN = IO::String->new($msgbuffer);
509 0 my $ioOUT = IO::String->new($msgbuffer);
510  
511 0 my $decoder = new MIME::Decoder $head->mime_encoding;
512 0 $decoder->decode($ioIN, $ioOUT);
513  
514 0 $ioIN->close;
515 0 $ioOUT->close;
516 }
517  
518 0 ▶ if ( $parms{checkFingerprint} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parms{"checkFingerprint"}) 0 0 0
519 0 foreach my $msgline ( split (/[\n\r]/, $msgbuffer) ) {
520 0 ▶ next unless ( $msgline );
Branch: 1 branch
BranchTrueFalseTotal
unless $msgline 0 0 0
521 0 ▶ last unless ( $self->{_mailType} ? $xmlNotFound : $fingerprintFound );
Branch: 2 branches
BranchTrueFalseTotal
unless $self->{"_mailType"} ? $xmlNotFound : $fingerprintFound 0 0 0
$self->{'_mailType'} ? : 0 0 0
522  
523 0 ▶ if ( $self->{_mailType} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_mailType'}) { } 0 0 0
524 0 ▶ if ( $msgline =~ /\Q$fingerprintXML\E/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgline =~ /\Q$fingerprintXML\E/) 0 0 0
525 0 $xmlNotFound = 0; $fingerprintFound--;
526 0 ▶ print "XML ..... : $msgline\n (match) : $msgline\n" if ( $debug );
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
527 0 my ( $returnCode, $xml ) = extract_XML ( asnmtapInherited => $self->{_asnmtapInherited}, resultXML => $msgline, headerXML => HEADER, footerXML => FOOTER, validateDTD => 0, filenameDTD => SYSTEM );
528  
529 0 ▶ unless ( $returnCode ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($returnCode) 0 0 0
530 0 ▶ if ( $xml->{Fingerprint}{From} =~ /^$self->{_mail}->{from}/ and $xml->{Fingerprint}{To} =~ /^$self->{_mail}->{to}/ and $xml->{Fingerprint}{Destination} eq 'ASNMTAP' and $xml->{Fingerprint}{Plugin} eq $$asnmtapInherited->{_programName} and $xml->{Fingerprint}{Description} eq $$asnmtapInherited->{_programDescription} and $xml->{Fingerprint}{Environment} eq $self->{_environment_} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{'Fingerprint'}{'From'} =~ /^$self->{'_mail'}{'from'}/ and $xml->{'Fingerprint'}{'To'} =~ /^$self->{'_mail'}{'to'}/ and $xml->{'Fingerprint'}{'Destination'} eq 'ASNMTAP' and $xml->{'Fingerprint'}{'Plugin'} eq $$asnmtapInherited->{'_programName'} and $xml->{'Fingerprint'}{'Description'} eq $$asnmtapInherited->{'_programDescription'} and $xml->{'Fingerprint'}{'Environment'} eq $self->{'_environment_'}) { } 0 0 0
Condition0%0/15
$xml->{"Fingerprint"}{"From"} =~ /^$self->{"_mail"}{"from"}/ and $xml->{"Fingerprint"}{"To"} =~ /^$self->{"_mail"}{"to"}/ and $xml->{"Fingerprint"}{"Destination"} eq "ASNMTAP" and $xml->{"Fingerprint"}{"Plugin"} eq $$asnmtapInherited->{"_programName"} and $xml->{"Fingerprint"}{"Description"} eq $$asnmtapInherited->{"_programDescription"} and $xml->{"Fingerprint"}{"Environment"} eq $self->{"_environment_"}
!ll&&!rl&&r
000
$xml->{"Fingerprint"}{"From"} =~ /^$self->{"_mail"}{"from"}/ and $xml->{"Fingerprint"}{"To"} =~ /^$self->{"_mail"}{"to"}/ and $xml->{"Fingerprint"}{"Destination"} eq "ASNMTAP" and $xml->{"Fingerprint"}{"Plugin"} eq $$asnmtapInherited->{"_programName"} and $xml->{"Fingerprint"}{"Description"} eq $$asnmtapInherited->{"_programDescription"}
!ll&&!rl&&r
000
$xml->{"Fingerprint"}{"From"} =~ /^$self->{"_mail"}{"from"}/ and $xml->{"Fingerprint"}{"To"} =~ /^$self->{"_mail"}{"to"}/ and $xml->{"Fingerprint"}{"Destination"} eq "ASNMTAP" and $xml->{"Fingerprint"}{"Plugin"} eq $$asnmtapInherited->{"_programName"}
!ll&&!rl&&r
000
$xml->{"Fingerprint"}{"From"} =~ /^$self->{"_mail"}{"from"}/ and $xml->{"Fingerprint"}{"To"} =~ /^$self->{"_mail"}{"to"}/ and $xml->{"Fingerprint"}{"Destination"} eq "ASNMTAP"
!ll&&!rl&&r
000
$xml->{"Fingerprint"}{"From"} =~ /^$self->{"_mail"}{"from"}/ and $xml->{"Fingerprint"}{"To"} =~ /^$self->{"_mail"}{"to"}/
!ll&&!rl&&r
000
MC/DC0%0/6
$xml->{"Fingerprint"}{"From"} =~ /^$self->{"_mail"}{"from"}/ and $xml->{"Fingerprint"}{"To"} =~ /^$self->{"_mail"}{"to"}/ and $xml->{"Fingerprint"}{"Destination"} eq "ASNMTAP" and $xml->{"Fingerprint"}{"Plugin"} eq $$asnmtapInherited->{"_programName"} and $xml->{"Fingerprint"}{"Description"} eq $$asnmtapInherited->{"_programDescription"} and $xml->{"Fingerprint"}{"Environment"} eq $self->{"_environment_"}
$xml->{"Fingerprint"}{"From"} =~ /^$self->{"_mail"}{"from"}/ $xml->{"Fingerprint"}{"To"} =~ /^$self->{"_mail"}{"to"}/ $xml->{"Fingerprint"}{"Destination"} eq "ASNMTAP" $xml->{"Fingerprint"}{"Plugin"} eq $$asnmtapInherited->{"_programName"} $xml->{"Fingerprint"}{"Description"} eq $$asnmtapInherited->{"_programDescription"} $xml->{"Fingerprint"}{"Environment"} eq $self->{"_environment_"}
Truth table0%0/7
A and B and C and D and E and F
A= $xml->{"Fingerprint"}{"From"} =~ /^$self->{"_mail"}{"from"}/B= $xml->{"Fingerprint"}{"To"} =~ /^$self->{"_mail"}{"to"}/C= $xml->{"Fingerprint"}{"Destination"} eq "ASNMTAP"D= $xml->{"Fingerprint"}{"Plugin"} eq $$asnmtapInherited->{"_programName"}E= $xml->{"Fingerprint"}{"Description"} eq $$asnmtapInherited->{"_programDescription"}F= $xml->{"Fingerprint"}{"Environment"} eq $self->{"_environment_"}
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
531 17 ▶ use Date::Calc qw(check_date);
Subroutine BEGIN: called CC=1 SCAR=0.0
532  
533 0 $self->{defaultArguments}->{date} = 0;
534 0 $self->{defaultArguments}->{year} = 0;
535 0 $self->{defaultArguments}->{month} = 0;
536 0 $self->{defaultArguments}->{day} = 0;
537  
538 0 $self->{defaultArguments}->{time} = 0;
539 0 $self->{defaultArguments}->{hour} = 0;
540 0 $self->{defaultArguments}->{min} = 0;
541 0 $self->{defaultArguments}->{sec} = 0;
542  
543 0 my $currentTimeslot = timelocal ( (localtime)[0,1,2,3,4,5] );
544 0 my ($checkEpochtime, $checkDate, $checkTime) = ($xml->{Fingerprint}{Epochtime}, $xml->{Fingerprint}{Date}, $xml->{Fingerprint}{Time});
545 0 my ($checkYear, $checkMonth, $checkDay) = split (/\/|-/, $checkDate);
546 0 my ($checkHour, $checkMin, $checkSec) = split (/:/, $checkTime);
547 0 my $xmlEpochtime = timelocal ( $checkSec, $checkMin, $checkHour, $checkDay, ($checkMonth-1), ($checkYear-1900) );
548 0 ▶ print "$checkEpochtime, $xmlEpochtime ($checkDate, $checkTime), $currentTimeslot - $checkEpochtime = ". ($currentTimeslot - $checkEpochtime) ." > ". $parms{outOfDate} ."\n" if ( $debug );
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
549  
550 0 ▶ unless ( check_date ( $checkYear, $checkMonth, $checkDay) or check_time($checkHour, $checkMin, $checkSec ) ) {
Branch: 4 branches
BranchTrueFalseTotal
if (check_date($checkYear, $checkMonth, $checkDay) or check_time($checkHour, $checkMin, $checkSec)) { } 0 0 0
if (do { $checkEpochtime != $xmlEpochtime }) { } 0 0 0
elsif ($currentTimeslot - $checkEpochtime > $parms{'outOfDate'} * 2) { } 0 0 0
elsif ($currentTimeslot - $checkEpochtime > $parms{'outOfDate'}) { } 0 0 0
Condition0%0/3
check_date($checkYear, $checkMonth, $checkDay) or check_time($checkHour, $checkMin, $checkSec)
l!l&&r!l&&!r
000
MC/DC0%0/2
check_date($checkYear, $checkMonth, $checkDay) or check_time($checkHour, $checkMin, $checkSec)
check_date($checkYear, $checkMonth, $checkDay) check_time($checkHour, $checkMin, $checkSec)
Truth table0%0/3
A or B
A= check_date($checkYear, $checkMonth, $checkDay)B= check_time($checkHour, $checkMin, $checkSec)
ABresult
1X1
011
000
551 0 $returnCode = $ERRORS{CRITICAL};
552 0 $$asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => "Date or Time into Fingerprint XML are wrong: $checkDate $checkTime" }, $TYPE{APPEND} );
553 } elsif ( $checkEpochtime != $xmlEpochtime ) {
554 0 $returnCode = $ERRORS{CRITICAL};
555 0 $$asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => "Epochtime difference from Date and Time into Fingerprint XML are wrong: $checkEpochtime != $xmlEpochtime ($checkDate $checkTime)" }, $TYPE{APPEND} );
556 } elsif ( $currentTimeslot - $checkEpochtime > $parms{outOfDate} * 2 ) {
557 0 $returnCode = $ERRORS{CRITICAL};
558 0 $$asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => "Result into Fingerprint XML are out of date: $checkDate $checkTime" }, $TYPE{APPEND} );
559 } elsif ( $currentTimeslot - $checkEpochtime > $parms{outOfDate} ) {
560 0 $returnCode = $ERRORS{WARNING};
561 0 $$asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => "Result into Fingerprint XML are out of date: $checkDate $checkTime" }, $TYPE{APPEND} );
562 } else {
563 0 ($self->{defaultArguments}->{date}, $self->{defaultArguments}->{time}) = ($checkDate, $checkTime);
564 0 ($self->{defaultArguments}->{day}, $self->{defaultArguments}->{month}, $self->{defaultArguments}->{year}) = split(/[\/|-]/, $checkDate);
565 0 ($self->{defaultArguments}->{hour}, $self->{defaultArguments}->{min}, $self->{defaultArguments}->{sec}) = split(/:/, $checkTime);
566 }
567  
568 0 $statusNotFound = ( $xml->{Fingerprint}{Status} ne $self->{_mail}->{status} );
569 0 ▶ my $label = $statusNotFound ? ' (?)' : '(match)';
Branch: 1 branch
BranchTrueFalseTotal
$statusNotFound ? : 0 0 0
570 0 ▶ print " $label : $self->{_text}->{status} < $self->{_mail}->{status} >\n" if ( $debug );
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
571 0 ▶ unless ( $statusNotFound ) { $fingerprintFound--; last; }
Branch: 1 branch
BranchTrueFalseTotal
unless ($statusNotFound) 0 0 0
572 } else {
573 0 ▶ if ( $debug ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug) 0 0 0
574 0 ▶ my $label = ( $xml->{Fingerprint}{From} =~ /^$self->{_mail}->{from}/ ? '(match)' : ' (?)' );
Branch: 1 branch
BranchTrueFalseTotal
$xml->{'Fingerprint'}{'From'} =~ /^$self->{'_mail'}{'from'}/ ? : 0 0 0
575 0 print " $label : $self->{_text}->{status} < $self->{_mail}->{status} >\n";
576 0 ▶ $label = ( $xml->{Fingerprint}{From} =~ /^$self->{_mail}->{from}/ ? '(match)' : ' (?)' );
Branch: 1 branch
BranchTrueFalseTotal
$xml->{'Fingerprint'}{'From'} =~ /^$self->{'_mail'}{'from'}/ ? : 0 0 0
577 0 print " $label : From ". $xml->{Fingerprint}{From} ."\n";
578 0 ▶ $label = ( $xml->{Fingerprint}{To} =~ /^$self->{_mail}->{to}/ ? '(match)' : ' (?)' );
Branch: 1 branch
BranchTrueFalseTotal
$xml->{'Fingerprint'}{'To'} =~ /^$self->{'_mail'}{'to'}/ ? : 0 0 0
579 0 print " $label : To ". $xml->{Fingerprint}{To} ."\n";
580 0 ▶ $label = ( $xml->{Fingerprint}{Destination} eq 'ASNMTAP' ? '(match)' : ' (?)' );
Branch: 1 branch
BranchTrueFalseTotal
$xml->{'Fingerprint'}{'Destination'} eq 'ASNMTAP' ? : 0 0 0
581 0 print " $label : Destination ". $xml->{Fingerprint}{Destination} ."\n";
582 0 ▶ $label = ( $xml->{Fingerprint}{Plugin} eq $$asnmtapInherited->{_programName} ? '(match)' : ' (?)' );
Branch: 1 branch
BranchTrueFalseTotal
$xml->{'Fingerprint'}{'Plugin'} eq $$asnmtapInherited->{'_programName'} ? : 0 0 0
583 0 print " $label : Plugin ". $xml->{Fingerprint}{Plugin} ."\n";
584 0 ▶ $label = ( $xml->{Fingerprint}{Description} eq $$asnmtapInherited->{_programDescription} ? '(match)' : ' (?)' );
Branch: 1 branch
BranchTrueFalseTotal
$xml->{'Fingerprint'}{'Description'} eq $$asnmtapInherited->{'_programDescription'} ? : 0 0 0
585 0 print " $label : Description ". $xml->{Fingerprint}{Description} ."\n";
586 0 ▶ $label = ( $xml->{Fingerprint}{Environment} =~ /^$self->{_environment_}/i ? '(match)' : ' (?)' );
Branch: 1 branch
BranchTrueFalseTotal
$xml->{'Fingerprint'}{'Environment'} =~ /^$self->{'_environment_'}/i ? : 0 0 0
587 0 print " $label : Environment ". $xml->{Fingerprint}{Environment} ."\n";
588 }
589  
590 0 last;
591 }
592 }
593
594 0 next;
595 }
596 } else {
597 0 ▶ if ( $messageNotFound ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($messageNotFound) 0 0 0
598 0 ▶ if ($msgline =~ /^$self->{_subject_}/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgline =~ /^$self->{"_subject_"}/) 0 0 0
599 0 ▶ print "Header .. : $msgline\n (match) : $msgline\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
600 0 $messageNotFound = 0; $fingerprintFound--; next;
601 }
602 }
603  
604 0 ▶ if ( $brandingNotFound ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($brandingNotFound) 0 0 0
605 0 ▶ if ( $msgline =~ /$$asnmtapInherited->{_programName}/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgline =~ /$$asnmtapInherited->{"_programName"}/) 0 0 0
606 0 ▶ if ( $debug ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug) 0 0 0
607 0 my $msglineDebug = $msgline; $msglineDebug =~ s/</< /g; $msglineDebug =~ s/>/ >/g;
608 0 print "Branding : $msglineDebug\n";
609 }
610  
611 0 $brandingNotFound = ( $msgline !~ /^$self->{_branding_}/ );
612 0 ▶ my $label = $brandingNotFound ? ' (?)' : '(match)';
Branch: 1 branch
BranchTrueFalseTotal
$brandingNotFound ? : 0 0 0
613  
614 0 ▶ if ( $debug ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug) 0 0 0
615 0 my $msglineDebug = $msgline; $msglineDebug =~ s/</< /g; $msglineDebug =~ s/>/ >/g;
616 0 print " $label : $msglineDebug\n";
617 }
618  
619 0 ▶ unless ( $brandingNotFound ) { $fingerprintFound--; next; }
Branch: 1 branch
BranchTrueFalseTotal
unless ($brandingNotFound) 0 0 0
620 }
621 }
622  
623 0 ▶ if ( $timestampNotFound ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($timestampNotFound) 0 0 0
624 0 ▶ if ( $msgline =~ /^$self->{_timestamp_}/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgline =~ /^$self->{"_timestamp_"}/) 0 0 0
625 0 ▶ print "Timestamp : $msgline\n" if ( $debug );
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
626 0 (undef, $msgline) = split(/:\s+/, $msgline, 2);
627 0 ($self->{defaultArguments}->{date}, $self->{defaultArguments}->{time}) = split(/\s+/, $msgline);
628 0 ($self->{defaultArguments}->{year}, $self->{defaultArguments}->{month}, $self->{defaultArguments}->{day}) = split(/[\/-]/, $self->{defaultArguments}->{date});
629 0 ($self->{defaultArguments}->{hour}, $self->{defaultArguments}->{min}, $self->{defaultArguments}->{sec}) = split(/:/, $self->{defaultArguments}->{time});
630 0 ▶ print ' (match) : ', $self->{_timestamp_}, ' ', $self->{defaultArguments}->{year}, '/', $self->{defaultArguments}->{month}, '/', $self->{defaultArguments}->{day}, ' ', $self->{defaultArguments}->{hour}, ':', $self->{defaultArguments}->{min}, ':', $self->{defaultArguments}->{sec}, "\n" if ( $debug );
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
631 0 $timestampNotFound = 0; $fingerprintFound--; next;
632 }
633 }
634  
635 0 ▶ if ( $fingerprintFound == 1 and $statusNotFound ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fingerprintFound == 1 and $statusNotFound) 0 0 0
Condition0%0/3
$fingerprintFound == 1 and $statusNotFound
!ll&&!rl&&r
000
MC/DC0%0/2
$fingerprintFound == 1 and $statusNotFound
$fingerprintFound == 1 $statusNotFound
Truth table0%0/3
A and B
A= $fingerprintFound == 1B= $statusNotFound
ABresult
0X0
100
111
636 0 ▶ if ( $msgline =~ /^$self->{_text}->{status}/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msgline =~ /^$self->{"_text"}{"status"}/) 0 0 0
637 0 ▶ if ( $debug ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug) 0 0 0
638 0 my $msglineDebug = $msgline; $msglineDebug =~ s/</< /g; $msglineDebug =~ s/>/ >/g;
639 0 print "Status .. : $msglineDebug\n";
640 }
641  
642 0 $statusNotFound = ( $msgline !~ /^$self->{_text}->{status}\s*<$self->{_mail}->{status}>/ );
643 0 ▶ my $label = $statusNotFound ? ' (?)' : '(match)';
Branch: 1 branch
BranchTrueFalseTotal
$statusNotFound ? : 0 0 0
644 0 ▶ print " $label : $self->{_text}->{status} < $self->{_mail}->{status} >\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
645 0 ▶ unless ( $statusNotFound ) { $fingerprintFound--; last; }
Branch: 1 branch
BranchTrueFalseTotal
unless ($statusNotFound) 0 0 0
646 }
647 }
648 }
649  
650 0 ▶ unless ( $fingerprintFound ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fingerprintFound) 0 0 0
651 0 $self->{defaultArguments}->{result} .= "$msgline\n";
652 0 ▶ print "- - - - - : $msgline\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
653 0 last;
654 }
655  
656 0 ▶ print ". . . . . : $msgline\n" if ($debug >= 2);
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
657 }
658 }
659 }
660  
661 0 ▶ if ( $fingerprintFound == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fingerprintFound == 0) 0 0 0
662 0 ▶ if ( $parms{checkFingerprint} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parms{'checkFingerprint'}) { } 0 0 0
663 0 ▶ my $regexp = ( $self->{_mailType} ? "\Q$fingerprintXML\E" .'.+'. "\Q<\/FingerprintEmail>\E" : $self->{_text}->{status} .'\s+<'. $self->{_mail}->{status} .'>' );
Branch: 1 branch
BranchTrueFalseTotal
$self->{'_mailType'} ? : 0 0 0
664 0 $msgbuffer =~ /$regexp/;
665 0 ▶ $self->{defaultArguments}->{result} = ( $' ) ? $' : '';
Branch: 1 branch
BranchTrueFalseTotal
$' ? : 0 0 0
666 } else {
667 0 $self->{defaultArguments}->{result} = $msgbuffer;
668 }
669  
670 0 ▶ print "\n", ref ($self), "::receiving_fingerprint_mails(): BODY MESSAGE\n". $self->{defaultArguments}->{result}. "\n" if ($debug >= 2);
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
671  
672 0 ▶ if ( defined $parms{custom} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $parms{'custom'}) { } 0 0 0
673 0 ▶ $returnCode = ( defined $parms{customArguments} ) ? $parms{custom}->($self, $self->{_asnmtapInherited}, $email, $msgnum, $parms{customArguments}) : $parms{custom}->($self, $self->{_asnmtapInherited}, $email, $msgnum);
Branch: 1 branch
BranchTrueFalseTotal
defined $parms{'customArguments'} ? : 0 0 0
674 } else {
675 0 $self->{defaultArguments}->{numberOfMatches}++;
676  
677 0 ▶ unless ( $debug or $$asnmtapInherited->getOptionsValue ('onDemand') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($debug or $$asnmtapInherited->getOptionsValue("onDemand")) 0 0 0
Condition0%0/3
$debug or $$asnmtapInherited->getOptionsValue("onDemand")
l!l&&r!l&&!r
000
MC/DC0%0/2
$debug or $$asnmtapInherited->getOptionsValue("onDemand")
$debug $$asnmtapInherited->getOptionsValue("onDemand")
Truth table0%0/3
A or B
A= $debugB= $$asnmtapInherited->getOptionsValue("onDemand")
ABresult
1X1
011
000
678 0 ▶ if ( defined $self->{_IMAP4}->{imap4} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->{'_IMAP4'}{'imap4'}) { } 0 0 0
elsif (defined $self->{'_POP3'}{'pop3'}) { } 0 0 0
679 0 $email->delete ( $msgnum );
680 } elsif ( defined $self->{_POP3}->{pop3} ) {
681 0 $email->Delete( $msgnum );
682 }
683 }
684 }
685 }
686  
687 0 $self->{defaultArguments}->{date} = undef;
688 0 $self->{defaultArguments}->{day} = undef;
689 0 $self->{defaultArguments}->{month} = undef;
690 0 $self->{defaultArguments}->{year} = undef;
691 0 $self->{defaultArguments}->{time} = undef;
692 0 $self->{defaultArguments}->{hour} = undef;
693 0 $self->{defaultArguments}->{min} = undef;
694 0 $self->{defaultArguments}->{sec} = undef;
695  
696 0 undef $head;
697 0 $entity->purge;
698 0 undef $entity;
699 }
700  
701 0 undef $parser;
702 }
703  
704 0 ▶ if ( defined $self->{defaultArguments}->{numberOfMatches} and $self->{defaultArguments}->{numberOfMatches} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'defaultArguments'}{'numberOfMatches'} and $self->{'defaultArguments'}{'numberOfMatches'}) { } 0 0 0
Condition0%0/3
defined $self->{"defaultArguments"}{"numberOfMatches"} and $self->{"defaultArguments"}{"numberOfMatches"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"defaultArguments"}{"numberOfMatches"} and $self->{"defaultArguments"}{"numberOfMatches"}
defined $self->{"defaultArguments"}{"numberOfMatches"} $self->{"defaultArguments"}{"numberOfMatches"}
Truth table0%0/3
A and B
A= defined $self->{"defaultArguments"}{"numberOfMatches"}B= $self->{"defaultArguments"}{"numberOfMatches"}
ABresult
0X0
100
111
705 0 ▶ $$asnmtapInherited->pluginValues ( { alert => $self->{defaultArguments}->{numberOfMatches} .' '. ( defined $parms{perfdataLabel} ? $parms{perfdataLabel} : 'email(s) received' ) }, $TYPE{APPEND} );
Branch: 1 branch
BranchTrueFalseTotal
defined $parms{'perfdataLabel'} ? : 0 0 0
706 } else {
707 0 ▶ $returnCode = $parms{receivedState} ? $ERRORS{OK} : $ERRORS{CRITICAL};
Branch: 1 branch
BranchTrueFalseTotal
$parms{'receivedState'} ? : 0 0 0
708 0 ▶ $$asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => 'No '. ( defined $parms{perfdataLabel} ? $parms{perfdataLabel} : 'email(s) received' ) }, $TYPE{APPEND} );
Branch: 1 branch
BranchTrueFalseTotal
defined $parms{'perfdataLabel'} ? : 0 0 0
709 }
710  
711 0 ▶ if ( defined $self->{_IMAP4}->{imap4} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->{'_IMAP4'}{'imap4'}) { } 0 0 0
elsif (defined $self->{'_POP3'}{'pop3'}) { } 0 0 0
712 0 $email->quit;
713 } elsif ( defined $self->{_POP3}->{pop3} ) {
714 0 $email->Close;
715 }
716  
717 0 ▶ $$asnmtapInherited->appendPerformanceData ( "'". $parms{perfdataLabel} ."'=". $self->{defaultArguments}->{numberOfMatches} .';;;;' ) if ( defined $parms{perfdataLabel} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $parms{"perfdataLabel"} 0 0 0
718 0 return ( $returnCode, $self->{defaultArguments}->{numberOfMatches} );
719 }
720 }
721  
722 # Destructor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
723  
724 1 ▶sub DESTROY { print (ref ($_[0]), "::DESTROY: ()\n") if ( exists $$_[0]->{_asnmtapInherited} and $$_[0]->{_asnmtapInherited}->{_debug} ); }
Subroutine DESTROY: called CC=3 SCAR=14.2
Branch: 1 branch
BranchTrueFalseTotal
if exists $_->[0]{"_asnmtapInherited"} and $_->[0]{"_asnmtapInherited"}{"_debug"} 0 1 1
Condition33%1/3
exists $_->[0]{"_asnmtapInherited"} and $_->[0]{"_asnmtapInherited"}{"_debug"}
!ll&&!rl&&r
100
MC/DC0%0/2
exists $_->[0]{"_asnmtapInherited"} and $_->[0]{"_asnmtapInherited"}{"_debug"}
exists $_->[0]{"_asnmtapInherited"} $_->[0]{"_asnmtapInherited"}{"_debug"}
Truth table33%1/3
A and B
A= exists $_->[0]{"_asnmtapInherited"}B= $_->[0]{"_asnmtapInherited"}{"_debug"}
ABresult
0X0
100
111
725  
726 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
727  
728 17 1;
729  
730 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
731  
732 __END__
↑ Summary blib/lib/ASNMTAP/Asnmtap/Plugins/Modem.pm »