Branch Coverage

blib/lib/EMDIS/ECS.pm
Criterion Covered Total %
branch 41 332 12.3


line true false branch
28 0 6 if ($^O =~ /MSWin32/)
69 0 0 if $^O =~ /MSWin32/
78 0 54 unless defined $val
79 18 36 if $val =~ /^\s*YES\s*$/io or $val =~ /^\s*TRUE\s*$/io
88 0 22 unless defined $val
89 15 7 if $val =~ /^\s*NO\s*$/io or $val =~ /^\s*FALSE\s*$/io
102 0 0 unless ref $cfg
107 0 0 unless ref $node_tbl
130 0 0 unless (-d $dirname)
135 0 0 unless ($cutoff_time =~ /^\d+$/)
146 0 0 unless -f $filename
149 0 0 if ($stat[9] < $cutoff_time)
151 0 0 unless unlink $filename
161 0 16 unless defined $str
162 9 7 if ($str =~ /^"(.*)"$/) { }
1 6 elsif ($str =~ /^'(.*)'$/) { }
184 6 0 unless (ecs_is_configured())
191 0 0 if not defined $level or $level < 0 or $level > $#EMDIS::ECS::LOG_LEVEL
193 0 0 if $level < $cfg->LOG_LEVEL and not $cfg->ECS_DEBUG
195 0 0 unless defined $text
200 0 0 unless (open LOG, '>>' . $cfg->LOG_FILE)
206 0 0 if $setmode
207 0 0 if ($level >= $cfg->MAIL_LEVEL)
229 0 0 unless -f $filename
230 0 0 unless -d $targetdir
237 0 0 if ($basename =~ /^(\d{8}_\d{6}_(.+_)?).{4}(\..{3})$/) { }
247 0 0 unless $fh
249 0 0 unless copy($filename, $fh)
265 0 0 unless $err
278 1 8 unless ecs_is_configured()
283 0 8 unless $fh->open("< $filename")
285 1 9 if (m[^Subject:.*$mail_mrk:(\S+?):(\d+):(\d+)/(\d+)\s*$]io)
288 4 5 if (/^Subject:.*$mail_mrk:(\S+?):(\d+)\s*$/io)
291 1 4 if (/^Subject:.*$mail_mrk:(\S+)\s*$/io)
294 2 2 if /^$/
309 1 0 unless ecs_is_configured()
314 0 1 unless ($err)
319 0 0 unless $fh
321 0 0 if ($fh)
328 0 1 unless ($err)
336 0 0 if $err and not $_[$#_] =~ /Unable to send admin email/iso
353 1 0 unless ecs_is_configured()
361 0 0 if ($seq_num and not $node_id)
365 0 0 unless $fml =~ /^.+:.+;/s
367 0 0 if ($fml =~ /HUB_RCV\s*=\s*([^,;]+)/is) { }
374 0 0 if ($fml =~ /HUB_SND\s*=\s*([^,;]+)/is) { }
381 0 0 unless $hub_snd eq $EMDIS::ECS::ECS_CFG->THIS_NODE
383 0 0 unless $node_id
384 0 0 unless $node_id eq $hub_rcv
391 0 0 unless ($was_locked)
392 0 0 unless $node_tbl->lock
397 0 0 unless ($node)
398 0 0 unless $was_locked
401 0 0 unless ($node->{'addr'})
402 0 0 unless $was_locked
405 0 0 if ($seq_num =~ /auto/i)
412 0 0 if $seq_num
417 0 0 if ($seq_num) { }
421 0 0 unless -e $dirname
429 0 0 unless -e $dirname
435 0 0 if (-e $filename) { }
438 0 0 unless $fh
444 0 0 unless $fh->open("> $filename")
456 0 0 if ($err) { }
0 0 elsif (not $seq_num || $node->{'encr_meta'} =~ /true/i) { }
475 0 0 unless ($err)
478 0 0 unless $node_tbl->write($node_id, $node)
482 0 0 unless $was_locked
496 1 0 unless ecs_is_configured()
501 0 0 if (is_yes($cfg->SMTP_USE_SSL) or is_yes($cfg->SMTP_USE_STARTTLS))
502 0 0 if 'CPAN::Version'->vlt($Net::SMTP::VERSION, '3.05')
505 0 0 if (is_yes($cfg->SMTP_USE_SSL)) { }
506 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)
516 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)
523 0 0 if (is_yes($cfg->SMTP_USE_STARTTLS))
524 0 0 unless ($smtp->starttls)
531 0 0 if ($cfg->SMTP_USERNAME and $cfg->SMTP_PASSWORD)
532 0 0 unless ($smtp->auth($cfg->SMTP_USERNAME, $cfg->SMTP_PASSWORD))
540 0 0 unless $smtp->mail($cfg->SMTP_FROM)
542 0 0 unless $smtp->to($recipient)
544 0 0 unless $smtp->data
546 0 0 unless $smtp->datasend("Subject: $subject\n")
548 0 0 unless $smtp->datasend("To: $recipient\n")
550 0 0 if ($cfg->ADM_ADDR =~ /\b$recipient\b/)
552 0 0 unless $smtp->datasend("Reply-To: $recipient\n")
555 0 0 unless $smtp->datasend("MIME-Version: 1.0\n")
557 0 0 unless $smtp->datasend("Content-Type: text/plain\n")
559 0 0 unless $smtp->datasend("Content-Transfer-Encoding: 7bit\n")
561 0 0 unless $smtp->datasend("\n")
563 0 0 unless $smtp->datasend(@_)
565 0 0 unless $smtp->dataend
567 0 0 unless $smtp->quit
585 1 0 unless ecs_is_configured()
596 0 0 unless $fh
606 0 0 if (/PGP2/i)
611 0 0 if (/OpenPGP/i)
623 0 0 if $result
627 0 0 unless $fh->open("< $encr_filename")
646 1 1 unless defined $format
658 1 0 unless ecs_is_configured()
680 1 0 unless ecs_is_configured()
688 0 0 if $cfg->ECS_DEBUG > 0
695 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
700 0 0 if $result
703 0 0 if (defined $required_signature and not $result)
704 0 0 unless ($EMDIS::ECS::cmd_output =~ /Good signature from[^\n]+$required_signature/is)
725 1 0 unless ecs_is_configured()
730 0 0 defined $encr_out_keyid && 0 < length $encr_out_keyid ? :
737 0 0 if $cfg->ECS_DEBUG > 0
744 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
749 0 0 if $result
764 1 0 unless ecs_is_configured()
772 0 0 if $cfg->ECS_DEBUG > 0
777 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
782 0 0 if $result =~ /^Status 0x0100/
783 0 0 if $result
786 0 0 if (defined $required_signature and not $result)
787 0 0 unless ($EMDIS::ECS::cmd_output =~ /Good signature from[^\n]+$required_signature/is)
808 1 0 unless ecs_is_configured()
813 0 0 defined $encr_out_keyid && 0 < length $encr_out_keyid ? :
820 0 0 if $cfg->ECS_DEBUG > 0
825 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
830 0 0 if $result
839 0 0 unless ecs_is_configured()
842 0 0 if (open PIDFILE, $EMDIS::ECS::pidfile)
845 0 0 if kill 0, $pid
857 0 0 unless ecs_is_configured()
871 0 0 $^O =~ /MSWin32/ ? :
891 0 0 unless open OLDIN, '< &STDIN'
892 0 0 unless open STDIN, '< &READ'
894 0 0 unless open OLDOUT, '>&STDOUT'
895 0 0 unless open STDOUT, ">$$.txt"
897 0 0 unless open OLDERR, '>&STDERR'
898 0 0 unless open STDERR, '>&STDOUT'
906 0 0 unless (defined $input_data)
913 0 0 if (-x "$appname.exe") { }
0 0 elsif (-x "$appname.bat") { }
922 0 0 if $cfg->ECS_DEBUG > 0
937 0 0 if ($rc) { }
938 0 0 if $cfg->ECS_DEBUG > 0
943 0 0 if (defined $winMsg) { }
946 0 0 if $cfg->ECS_DEBUG > 0
952 0 0 if ($rc)
957 0 0 if $cfg->ECS_DEBUG > 0
962 0 0 if ($rc) { }
965 0 0 if $cfg->ECS_DEBUG > 0
969 0 0 if $cfg->ECS_DEBUG > 0
991 0 0 if (open FILETEMP, "< $$.txt")
1002 0 0 if ($#msgs >= 0) { }
1039 0 0 if defined $input_data
1045 0 0 if $broken_pipe
1048 0 0 if ($@) { }
0 0 elsif ($status) { }
1051 0 0 if not defined $pid and $@ =~ /^open2/
1062 0 0 $signal_num ? :
0 0 $dumped_core ? :
1067 0 0 if $writer->opened
1068 0 0 if $reader->opened
1069 0 0 if (defined $oldsigpipe) { }
1071 0 0 if (defined $oldsigalrm) { }
1073 0 0 if $result and $#msgs >= 0
1075 0 0 if ($#msgs >= 0) { }
1084 0 0 if $EMDIS::ECS::pidfile
1091 0 15 unless defined $str
1103 2 2 if /PGP2/i
1104 2 0 if /OpenPGP/i