Branch Coverage

blib/lib/EMDIS/ECS.pm
Criterion Covered Total %
branch 43 460 9.3


line true false branch
30 0 6 if ($^O =~ /MSWin32/)
72 0 0 if $^O =~ /MSWin32/
81 0 95 unless defined $val
82 24 71 if $val =~ /^\s*YES\s*$/io or $val =~ /^\s*TRUE\s*$/io
91 0 32 unless defined $val
92 25 7 if $val =~ /^\s*NO\s*$/io or $val =~ /^\s*FALSE\s*$/io
105 0 0 unless ref $cfg
110 0 0 unless ref $node_tbl
133 0 0 unless (-d $dirname)
138 0 0 unless ($cutoff_time =~ /^\d+$/)
149 0 0 unless -f $filename
152 0 0 if ($stat[9] < $cutoff_time)
154 0 0 unless unlink $filename
164 0 12 unless defined $str
165 5 7 if ($str =~ /^"(.*)"$/) { }
1 6 elsif ($str =~ /^'(.*)'$/) { }
187 6 0 unless (ecs_is_configured())
194 0 0 if not defined $level or $level < 0 or $level > $#EMDIS::ECS::LOG_LEVEL
196 0 0 if $level < $cfg->LOG_LEVEL and not $cfg->ECS_DEBUG
198 0 0 unless defined $text
203 0 0 if ('__STDOUT__' eq $cfg->LOG_FILE) { }
208 0 0 if (open LOG, '>>' . $cfg->LOG_FILE) { }
211 0 0 if $setmode
218 0 0 if ($level >= $cfg->MAIL_LEVEL)
240 0 0 unless -f $filename
241 0 0 unless -d $targetdir
248 0 0 if ($basename =~ /^(\d{8}_\d{6}_(.+_)?).{4}(\..{3})$/) { }
258 0 0 unless $fh
260 0 0 unless copy($filename, $fh)
276 0 0 unless $err
290 0 0 if $err
294 0 0 unless my $access_token = $EMDIS::ECS::cmd_output
310 1 9 unless ecs_is_configured()
315 0 9 unless $fh->open("< $filename")
317 1 10 if (m[^Subject:.*$mail_mrk:(\S+?):(\d+):(\d+)/(\d+)\s*$]io)
320 4 6 if (/^Subject:.*$mail_mrk:(\S+?):(\d+)\s*$/io)
323 1 5 if (/^Subject:.*$mail_mrk:(\S+?):(\d+):DOC\s*$/io)
326 1 4 if (/^Subject:.*$mail_mrk:(\S+)\s*$/io)
329 2 2 if /^$/
344 1 0 unless ecs_is_configured()
349 0 1 unless ($err)
354 0 0 unless $fh
356 0 0 if ($fh)
363 0 1 unless ($err)
371 0 0 if $err and not $_[$#_] =~ /Unable to send admin email/iso
388 1 0 unless ecs_is_configured()
396 0 0 if ($seq_num and not $node_id)
400 0 0 unless $fml =~ /^.+:.+;/s
402 0 0 if ($fml =~ /HUB_RCV\s*=\s*([^,;]+)/is) { }
409 0 0 if ($fml =~ /HUB_SND\s*=\s*([^,;]+)/is) { }
416 0 0 unless $hub_snd eq $EMDIS::ECS::ECS_CFG->THIS_NODE
418 0 0 unless $node_id
419 0 0 unless $node_id eq $hub_rcv
426 0 0 unless ($was_locked)
427 0 0 unless $node_tbl->lock
432 0 0 unless ($node)
433 0 0 unless $was_locked
436 0 0 unless ($node->{'addr'})
437 0 0 unless $was_locked
440 0 0 if ($seq_num =~ /auto/i)
447 0 0 if $seq_num
452 0 0 if ($seq_num) { }
456 0 0 unless -e $dirname
464 0 0 unless -e $dirname
470 0 0 if (-e $filename) { }
473 0 0 unless $fh
479 0 0 unless $fh->open("> $filename")
491 0 0 if ($err) { }
0 0 elsif (not $seq_num || $node->{'encr_meta'} =~ /true/i) { }
496 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'})) { }
528 0 0 unless ($err)
531 0 0 unless $node_tbl->write($node_id, $node)
535 0 0 unless $was_locked
550 1 0 unless ecs_is_configured()
554 0 0 if defined $custom_headers and not "HASH" eq ref $custom_headers
559 0 0 if (is_yes($cfg->SMTP_USE_SSL) or is_yes($cfg->SMTP_USE_STARTTLS))
560 0 0 if "CPAN::Version"->vlt($Net::SMTP::VERSION, "3.05")
563 0 0 if (is_yes($cfg->SMTP_USE_SSL)) { }
564 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)
574 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)
581 0 0 if (is_yes($cfg->SMTP_USE_STARTTLS))
582 0 0 unless ($smtp->starttls)
589 0 0 if ($cfg->SMTP_OAUTH_TOKEN_CMD) { }
590 0 0 unless (is_yes($EMDIS::ECS::ECS_CFG->SMTP_USE_SSL) or is_yes($EMDIS::ECS::ECS_CFG->SMTP_USE_STARTTLS))
595 0 0 if "CPAN::Version"->vlt($Authen::SASL::Perl::VERSION, "2.1800")
604 0 0 if ($err)
616 0 0 unless ($sasl)
621 0 0 unless ($smtp->auth($sasl))
630 0 0 if ($cfg->SMTP_USERNAME and $cfg->SMTP_PASSWORD)
631 0 0 unless ($smtp->auth($cfg->SMTP_USERNAME, $cfg->SMTP_PASSWORD))
640 0 0 unless $smtp->mail($cfg->SMTP_FROM)
642 0 0 unless $smtp->to($recipient)
644 0 0 unless $smtp->data
646 0 0 if (defined $custom_headers)
651 0 0 unless $smtp->datasend("${key}: $value\n")
656 0 0 unless $smtp->datasend("From: $from_addr\n")
658 0 0 unless $smtp->datasend("Subject: $subject\n")
660 0 0 unless $smtp->datasend("To: $recipient\n")
662 0 0 if ($cfg->ADM_ADDR =~ /\b$recipient\b/)
664 0 0 unless $smtp->datasend("Reply-To: $recipient\n")
667 0 0 unless $smtp->datasend("MIME-Version: 1.0\n")
669 0 0 unless $smtp->datasend("Content-Type: text/plain\n")
671 0 0 unless $smtp->datasend("Content-Transfer-Encoding: 7bit\n")
673 0 0 unless $smtp->datasend("\n")
675 0 0 unless $smtp->datasend(@_)
677 0 0 unless $smtp->dataend
679 0 0 unless $smtp->quit
697 0 0 unless (defined $amqp_addr)
701 0 0 unless (defined $subject)
705 0 0 if (not defined $node) { }
0 0 elsif (not 'HASH' eq ref $node) { }
709 0 0 ref $custom_properties ? :
713 0 0 if (defined $custom_properties and not "HASH" eq ref $custom_properties)
714 0 0 ref $custom_properties ? :
718 0 0 if (exists $node->{'node_disabled'} and is_yes($node->{'node_disabled'}))
738 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'} ? :
744 0 0 if exists $node->{$opt}
751 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) { }
767 0 0 if ($EMDIS::ECS::ECS_CFG->THIS_NODE ne $hub_snd)
772 0 0 $node->{'node'} ? :
0 0 $seq_num ? :
777 0 0 if (defined $custom_properties)
792 0 0 if $send_opts->{'amqp_content_type'}
794 0 0 if $send_opts->{'amqp_encoding'}
796 0 0 if $send_opts->{'amqp_vhost'}
798 0 0 if $send_opts->{'amqp_truststore'}
802 0 0 if $send_opts->{'amqp_sslcert'} and $send_opts->{'amqp_sslkey'}
804 0 0 if $send_opts->{'amqp_username'}
807 0 0 if $send_props->{$prop}
813 0 0 if $send_opts->{'amqp_password'}
815 0 0 if $send_opts->{'amqp_sslpass'}
818 0 0 if $EMDIS::ECS::ECS_CFG->ECS_DEBUG > 0
821 0 0 if ($err)
843 1 0 unless ecs_is_configured()
854 0 0 unless $fh
864 0 0 if (/PGP2/i)
869 0 0 if (/OpenPGP/i)
881 0 0 if $result
885 0 0 unless $fh->open("< $encr_filename")
894 0 0 if (is_yes($cfg->ENABLE_AMQP))
897 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'})) { }
901 0 0 if not $node->{'amqp_addr_meta'} and is_yes($node->{'amqp_only'})
908 0 0 if not $node->{'amqp_addr_doc'} and is_yes($node->{'amqp_only'})
915 0 0 if not $node->{'amqp_addr_msg'} and is_yes($node->{'amqp_only'})
923 0 0 if ($amqp_addr)
933 0 0 if (is_yes($node->{'amqp_only'}))
938 0 0 if ($node->{'amqp_addr_meta'} or $node->{'amqp_addr_msg'} or $node->{'amqp_addr_doc'})
941 0 0 if $cfg->ECS_DEBUG > 0
955 1 1 unless defined $format
967 0 0 unless ecs_is_configured()
982 1 0 unless ecs_is_configured()
1004 1 0 unless ecs_is_configured()
1012 0 0 if $cfg->ECS_DEBUG > 0
1019 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1024 0 0 if $result
1027 0 0 if (defined $required_signature and not $result)
1028 0 0 unless ($EMDIS::ECS::cmd_output =~ /Good signature from[^\n]+$required_signature/is)
1049 1 0 unless ecs_is_configured()
1054 0 0 defined $encr_out_keyid && 0 < length $encr_out_keyid ? :
1061 0 0 if $cfg->ECS_DEBUG > 0
1068 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1073 0 0 if $result
1088 1 0 unless ecs_is_configured()
1096 0 0 if $cfg->ECS_DEBUG > 0
1101 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1107 0 0 if $result =~ /^Status 0x0100/
1108 0 0 if $result
1111 0 0 if (defined $required_signature and not $result)
1112 0 0 unless ($EMDIS::ECS::cmd_output =~ /Good signature from[^\n]+$required_signature/is)
1133 1 0 unless ecs_is_configured()
1138 0 0 defined $encr_out_keyid && 0 < length $encr_out_keyid ? :
1145 0 0 if $cfg->ECS_DEBUG > 0
1150 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1156 0 0 if $result
1165 0 0 unless ecs_is_configured()
1168 0 0 if (open PIDFILE, $EMDIS::ECS::pidfile)
1171 0 0 if kill 0, $pid
1183 0 0 unless ecs_is_configured()
1197 0 0 $^O =~ /MSWin32/ ? :
1220 0 0 unless open OLDIN, "< &STDIN"
1221 0 0 unless open STDIN, "< &READ"
1223 0 0 unless open OLDOUT, ">&STDOUT"
1224 0 0 unless open STDOUT, ">${$}.txt"
1226 0 0 unless open OLDERR, ">&STDERR"
1227 0 0 unless open STDERR, ">&STDOUT"
1235 0 0 unless (defined $input_data)
1242 0 0 if (-x "$appname.exe") { }
0 0 elsif (-x "$appname.bat") { }
1251 0 0 if $cfg->ECS_DEBUG > 0
1266 0 0 if ($rc) { }
1267 0 0 if $cfg->ECS_DEBUG > 0
1272 0 0 if (defined $winMsg) { }
1275 0 0 if $cfg->ECS_DEBUG > 0
1281 0 0 if ($rc)
1286 0 0 if $cfg->ECS_DEBUG > 0
1291 0 0 if ($rc) { }
1294 0 0 if $cfg->ECS_DEBUG > 0
1298 0 0 if $cfg->ECS_DEBUG > 0
1320 0 0 if (open FILETEMP, "< ${$}.txt")
1331 0 0 if ($#msgs >= 0) { }
1371 0 0 if defined $input_data
1377 0 0 if $broken_pipe
1380 0 0 if ($@) { }
0 0 elsif ($status) { }
1383 0 0 if not defined $pid and $@ =~ /^open2/
1394 0 0 $signal_num ? :
0 0 $dumped_core ? :
1399 0 0 if $writer->opened
1400 0 0 if $reader->opened
1401 0 0 if (defined $oldsigpipe) { }
1403 0 0 if (defined $oldsigalrm) { }
1405 0 0 if $result and $#msgs >= 0
1407 0 0 if ($#msgs >= 0) { }
1416 0 0 if $EMDIS::ECS::pidfile
1423 0 11 unless defined $str
1435 2 2 if /PGP2/i
1436 2 0 if /OpenPGP/i