Branch Coverage

blib/lib/EMDIS/ECS.pm
Criterion Covered Total %
branch 43 440 9.7


line true false branch
28 0 6 if ($^O =~ /MSWin32/)
70 0 0 if $^O =~ /MSWin32/
79 0 64 unless defined $val
80 18 46 if $val =~ /^\s*YES\s*$/io or $val =~ /^\s*TRUE\s*$/io
89 0 22 unless defined $val
90 15 7 if $val =~ /^\s*NO\s*$/io or $val =~ /^\s*FALSE\s*$/io
103 0 0 unless ref $cfg
108 0 0 unless ref $node_tbl
131 0 0 unless (-d $dirname)
136 0 0 unless ($cutoff_time =~ /^\d+$/)
147 0 0 unless -f $filename
150 0 0 if ($stat[9] < $cutoff_time)
152 0 0 unless unlink $filename
162 0 12 unless defined $str
163 5 7 if ($str =~ /^"(.*)"$/) { }
1 6 elsif ($str =~ /^'(.*)'$/) { }
185 6 0 unless (ecs_is_configured())
192 0 0 if not defined $level or $level < 0 or $level > $#EMDIS::ECS::LOG_LEVEL
194 0 0 if $level < $cfg->LOG_LEVEL and not $cfg->ECS_DEBUG
196 0 0 unless defined $text
201 0 0 unless (open LOG, '>>' . $cfg->LOG_FILE)
207 0 0 if $setmode
208 0 0 if ($level >= $cfg->MAIL_LEVEL)
230 0 0 unless -f $filename
231 0 0 unless -d $targetdir
238 0 0 if ($basename =~ /^(\d{8}_\d{6}_(.+_)?).{4}(\..{3})$/) { }
248 0 0 unless $fh
250 0 0 unless copy($filename, $fh)
266 0 0 unless $err
279 1 9 unless ecs_is_configured()
284 0 9 unless $fh->open("< $filename")
286 1 10 if (m[^Subject:.*$mail_mrk:(\S+?):(\d+):(\d+)/(\d+)\s*$]io)
289 4 6 if (/^Subject:.*$mail_mrk:(\S+?):(\d+)\s*$/io)
292 1 5 if (/^Subject:.*$mail_mrk:(\S+?):(\d+):DOC\s*$/io)
295 1 4 if (/^Subject:.*$mail_mrk:(\S+)\s*$/io)
298 2 2 if /^$/
313 1 0 unless ecs_is_configured()
318 0 1 unless ($err)
323 0 0 unless $fh
325 0 0 if ($fh)
332 0 1 unless ($err)
340 0 0 if $err and not $_[$#_] =~ /Unable to send admin email/iso
357 1 0 unless ecs_is_configured()
365 0 0 if ($seq_num and not $node_id)
369 0 0 unless $fml =~ /^.+:.+;/s
371 0 0 if ($fml =~ /HUB_RCV\s*=\s*([^,;]+)/is) { }
378 0 0 if ($fml =~ /HUB_SND\s*=\s*([^,;]+)/is) { }
385 0 0 unless $hub_snd eq $EMDIS::ECS::ECS_CFG->THIS_NODE
387 0 0 unless $node_id
388 0 0 unless $node_id eq $hub_rcv
395 0 0 unless ($was_locked)
396 0 0 unless $node_tbl->lock
401 0 0 unless ($node)
402 0 0 unless $was_locked
405 0 0 unless ($node->{'addr'})
406 0 0 unless $was_locked
409 0 0 if ($seq_num =~ /auto/i)
416 0 0 if $seq_num
421 0 0 if ($seq_num) { }
425 0 0 unless -e $dirname
433 0 0 unless -e $dirname
439 0 0 if (-e $filename) { }
442 0 0 unless $fh
448 0 0 unless $fh->open("> $filename")
460 0 0 if ($err) { }
0 0 elsif (not $seq_num || $node->{'encr_meta'} =~ /true/i) { }
465 0 0 if (is_yes($cfg->ENABLE_AMQP) and exists $node->{'amqp_addr_meta'} and $node->{'amqp_addr_meta'}) { }
0 0 elsif (is_yes($node->{'amqp_only'})) { }
497 0 0 unless ($err)
500 0 0 unless $node_tbl->write($node_id, $node)
504 0 0 unless $was_locked
519 1 0 unless ecs_is_configured()
523 0 0 if defined $custom_headers and not 'HASH' eq ref $custom_headers
528 0 0 if (is_yes($cfg->SMTP_USE_SSL) or is_yes($cfg->SMTP_USE_STARTTLS))
529 0 0 if 'CPAN::Version'->vlt($Net::SMTP::VERSION, '3.05')
532 0 0 if (is_yes($cfg->SMTP_USE_SSL)) { }
533 0 0 unless $smtp = 'Net::SMTP'->new($cfg->SMTP_HOST, 'Hello', $cfg->SMTP_DOMAIN, 'Timeout', $cfg->SMTP_TIMEOUT, 'Debug', $cfg->SMTP_DEBUG, 'Port', $cfg->SMTP_PORT, 'SSL', 1)
543 0 0 unless $smtp = 'Net::SMTP'->new($cfg->SMTP_HOST, 'Hello', $cfg->SMTP_DOMAIN, 'Timeout', $cfg->SMTP_TIMEOUT, 'Debug', $cfg->SMTP_DEBUG, 'Port', $cfg->SMTP_PORT)
550 0 0 if (is_yes($cfg->SMTP_USE_STARTTLS))
551 0 0 unless ($smtp->starttls)
558 0 0 if ($cfg->SMTP_USERNAME and $cfg->SMTP_PASSWORD)
559 0 0 unless ($smtp->auth($cfg->SMTP_USERNAME, $cfg->SMTP_PASSWORD))
567 0 0 unless $smtp->mail($cfg->SMTP_FROM)
569 0 0 unless $smtp->to($recipient)
571 0 0 unless $smtp->data
573 0 0 if (defined $custom_headers)
578 0 0 unless $smtp->datasend("${key}: $value\n")
582 0 0 unless $smtp->datasend("Subject: $subject\n")
584 0 0 unless $smtp->datasend("To: $recipient\n")
586 0 0 if ($cfg->ADM_ADDR =~ /\b$recipient\b/)
588 0 0 unless $smtp->datasend("Reply-To: $recipient\n")
591 0 0 unless $smtp->datasend("MIME-Version: 1.0\n")
593 0 0 unless $smtp->datasend("Content-Type: text/plain\n")
595 0 0 unless $smtp->datasend("Content-Transfer-Encoding: 7bit\n")
597 0 0 unless $smtp->datasend("\n")
599 0 0 unless $smtp->datasend(@_)
601 0 0 unless $smtp->dataend
603 0 0 unless $smtp->quit
621 0 0 unless (defined $amqp_addr)
625 0 0 unless (defined $subject)
629 0 0 if (not defined $node) { }
0 0 elsif (not 'HASH' eq ref $node) { }
633 0 0 ref $custom_properties ? :
637 0 0 if (defined $custom_properties and not 'HASH' eq ref $custom_properties)
638 0 0 ref $custom_properties ? :
642 0 0 if (exists $node->{'node_disabled'} and is_yes($node->{'node_disabled'}))
662 0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_PASSWORD'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_SSLCERT'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_SSLKEY'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_SSLPASS'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_TRUSTSTORE'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_USERNAME'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_VHOST'} ? :
668 0 0 if exists $node->{$opt}
675 0 0 if ($subject =~ m[$mail_mrk:(\S+?):(\d+):(\d+)/(\d+)\s*$]io) { }
0 0 elsif ($subject =~ /$mail_mrk:(\S+?):(\d+)\s*$/io) { }
0 0 elsif ($subject =~ /$mail_mrk:(\S+?):(\d+):DOC\s*$/io) { }
0 0 elsif ($subject =~ /$mail_mrk:(\S+)\s*$/io) { }
691 0 0 if ($EMDIS::ECS::ECS_CFG->THIS_NODE ne $hub_snd)
696 0 0 $node->{'node'} ? :
0 0 $seq_num ? :
701 0 0 if (defined $custom_properties)
716 0 0 if $send_opts->{'amqp_content_type'}
718 0 0 if $send_opts->{'amqp_encoding'}
720 0 0 if $send_opts->{'amqp_vhost'}
722 0 0 if $send_opts->{'amqp_truststore'}
726 0 0 if $send_opts->{'amqp_sslcert'} and $send_opts->{'amqp_sslkey'}
728 0 0 if $send_opts->{'amqp_username'}
731 0 0 if $send_props->{$prop}
737 0 0 if $send_opts->{'amqp_password'}
739 0 0 if $send_opts->{'amqp_sslpass'}
742 0 0 if $EMDIS::ECS::ECS_CFG->ECS_DEBUG > 0
745 0 0 if ($err)
767 1 0 unless ecs_is_configured()
778 0 0 unless $fh
788 0 0 if (/PGP2/i)
793 0 0 if (/OpenPGP/i)
805 0 0 if $result
809 0 0 unless $fh->open("< $encr_filename")
818 0 0 if (is_yes($cfg->ENABLE_AMQP))
821 0 0 if ($subject =~ /^[^:]+:[^:]+$/io) { }
0 0 elsif ($subject =~ /^[^:]+:[^:]+:[0123456789]+:DOC/io) { }
0 0 elsif ($subject =~ /^[^:]+:[^:]+:[0123456789]+/io) { }
0 0 elsif (is_yes($node->{'amqp_only'})) { }
825 0 0 if not $node->{'amqp_addr_meta'} and is_yes($node->{'amqp_only'})
832 0 0 if not $node->{'amqp_addr_doc'} and is_yes($node->{'amqp_only'})
839 0 0 if not $node->{'amqp_addr_msg'} and is_yes($node->{'amqp_only'})
847 0 0 if ($amqp_addr)
857 0 0 if (is_yes($node->{'amqp_only'}))
862 0 0 if ($node->{'amqp_addr_meta'} or $node->{'amqp_addr_msg'} or $node->{'amqp_addr_doc'})
865 0 0 if $cfg->ECS_DEBUG > 0
879 1 1 unless defined $format
891 0 0 unless ecs_is_configured()
906 1 0 unless ecs_is_configured()
928 1 0 unless ecs_is_configured()
936 0 0 if $cfg->ECS_DEBUG > 0
943 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
948 0 0 if $result
951 0 0 if (defined $required_signature and not $result)
952 0 0 unless ($EMDIS::ECS::cmd_output =~ /Good signature from[^\n]+$required_signature/is)
973 1 0 unless ecs_is_configured()
978 0 0 defined $encr_out_keyid && 0 < length $encr_out_keyid ? :
985 0 0 if $cfg->ECS_DEBUG > 0
992 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
997 0 0 if $result
1012 1 0 unless ecs_is_configured()
1020 0 0 if $cfg->ECS_DEBUG > 0
1025 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1030 0 0 if $result =~ /^Status 0x0100/
1031 0 0 if $result
1034 0 0 if (defined $required_signature and not $result)
1035 0 0 unless ($EMDIS::ECS::cmd_output =~ /Good signature from[^\n]+$required_signature/is)
1056 1 0 unless ecs_is_configured()
1061 0 0 defined $encr_out_keyid && 0 < length $encr_out_keyid ? :
1068 0 0 if $cfg->ECS_DEBUG > 0
1073 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1078 0 0 if $result
1087 0 0 unless ecs_is_configured()
1090 0 0 if (open PIDFILE, $EMDIS::ECS::pidfile)
1093 0 0 if kill 0, $pid
1105 0 0 unless ecs_is_configured()
1119 0 0 $^O =~ /MSWin32/ ? :
1139 0 0 unless open OLDIN, '< &STDIN'
1140 0 0 unless open STDIN, '< &READ'
1142 0 0 unless open OLDOUT, '>&STDOUT'
1143 0 0 unless open STDOUT, ">$$.txt"
1145 0 0 unless open OLDERR, '>&STDERR'
1146 0 0 unless open STDERR, '>&STDOUT'
1154 0 0 unless (defined $input_data)
1161 0 0 if (-x "$appname.exe") { }
0 0 elsif (-x "$appname.bat") { }
1170 0 0 if $cfg->ECS_DEBUG > 0
1185 0 0 if ($rc) { }
1186 0 0 if $cfg->ECS_DEBUG > 0
1191 0 0 if (defined $winMsg) { }
1194 0 0 if $cfg->ECS_DEBUG > 0
1200 0 0 if ($rc)
1205 0 0 if $cfg->ECS_DEBUG > 0
1210 0 0 if ($rc) { }
1213 0 0 if $cfg->ECS_DEBUG > 0
1217 0 0 if $cfg->ECS_DEBUG > 0
1239 0 0 if (open FILETEMP, "< $$.txt")
1250 0 0 if ($#msgs >= 0) { }
1287 0 0 if defined $input_data
1293 0 0 if $broken_pipe
1296 0 0 if ($@) { }
0 0 elsif ($status) { }
1299 0 0 if not defined $pid and $@ =~ /^open2/
1310 0 0 $signal_num ? :
0 0 $dumped_core ? :
1315 0 0 if $writer->opened
1316 0 0 if $reader->opened
1317 0 0 if (defined $oldsigpipe) { }
1319 0 0 if (defined $oldsigalrm) { }
1321 0 0 if $result and $#msgs >= 0
1323 0 0 if ($#msgs >= 0) { }
1332 0 0 if $EMDIS::ECS::pidfile
1339 0 11 unless defined $str
1351 2 2 if /PGP2/i
1352 2 0 if /OpenPGP/i