Branch Coverage

blib/lib/Envy/DB.pm
Criterion Covered Total %
branch 221 336 65.7


line true false branch
42 7 0 $env ? :
55 5 14 unless $$o{'env'}{&EVERSION}
63 16 0 if (@_) { }
79 7 163 if ($show_context) { }
80 3 4 if $Envy::DB::Context and not $w =~ /\n$/s
85 151 19 unless $w =~ /\n$/s
86 1 169 if ($level <= $$o{'strictness'})
90 8 162 if $level <= $$o{'warnlevel'}
102 54 243 if (not exists $$orig{$k}) { }
15 228 elsif (not exists $$env{$k}) { }
40 188 elsif ($$orig{$k} ne $$env{$k}) { }
125 0 15 if exists $PATH{$p}
130 1 14 unless opendir $dh, $p
132 28 182 unless $m =~ /\.(mo|env)$/
133 0 182 if -d "$p/$m"
135 0 182 if ($m =~ /[,\s]/)
139 0 182 unless $m =~ /\.env$/
144 0 182 if ($m =~ /^\d$/)
148 182 0 if (not exists $$o{'fullpath'}{$m}) { }
159 5 9 unless @add
160 0 14 if (exists $$o{'env'}{'HOME'} and -d $$o{'env'}{'HOME'} . '/.envy')
165 0 15 if (-d "$p/.priv") { }
0 15 elsif (-d "$p/.private") { }
176 6 30 unless exists $$o{'fullpath'}
177 0 36 if (not defined $mo) { }
36 0 elsif (exists $$o{'fullpath'}{$mo}) { }
0 0 elsif (-f $mo) { }
195 3 19 if $$o{'transaction'}
206 0 19 if $v > $Envy::DB::EVERSION
216 0 40 if $v eq 'STARTUP'
229 0 19 if $$o{'transaction'} != 1
231 1 18 if $$o{'errors'}
256 32 61 if (@_ == 1) { }
61 0 elsif (@_ == 2) { }
262 61 0 if $f
276 9 19 unless $rc
277 5 14 if $rc eq '1'
278 14 0 unless $rc =~ /^\d+$/
283 11 29 unless exists $$o{'loaded'}{$e}
285 22 7 if $rc eq '0' or not $rc =~ /^\d+$/
291 5 0 if ($rc <= 0) { }
301 5 16 if ($o->is_first($e)) { }
16 0 elsif (not exists $$l{$e}) { }
313 7 0 if ($rc <= 1) { }
315 0 6 if $old and not $old =~ /^\d+$/ and $old ne $by
326 8 8 if exists $$o{'dimen'}{$di}
327 11 5 if ($how > 0) { }
328 4 7 if ($o->is_first) { }
329 0 4 if ($di ne 'First')
335 1 6 if ($di eq 'First')
336 1 0 if ($by eq $$o{'first'}) { }
337 0 1 unless $$o{'unload_all'}
343 2 5 if ($old and $old ne $by)
350 5 6 if $di eq 'First'
368 0 0 unless exists $$o{'fullpath'}
374 0 0 if (open $fh, $$o{'fullpath'}{$mo})
380 0 0 if (defined $$o{'desc'}{$mo} and $$o{'desc'}{$mo} ne '') { }
400 30 6 if length $$o{'env'}{$k} < $Envy::DB::MAX_VAR_LENGTH
402 3 3 if @var <= 1
409 0 11 if (exists $$o{'env'}{$ck})
419 8 3 if @chunk and length($c) + $csz > $Envy::DB::MAX_VAR_LENGTH
423 3 0 if @chunk
430 26 12 if exists $$o{'env'}{$k}
445 0 37 if ($var eq 'MODULE_BASE' or $var eq 'modulebase' or $var eq 'ENVY_LINKBASE') { }
25 12 elsif ($var eq 'MODULE_REALBASE' or $var eq 'ENVY_BASE') { }
12 0 elsif ($var =~ /^ENVY_(R|E)UID([_\w]*)$/) { }
447 0 0 if $var =~ /module/i
451 0 25 if $var =~ /module/i
455 0 0 unless my $link = readlink $rbase
456 0 0 if ($link =~ m[^/]) { }
471 6 6 $1 eq 'R' ? :
475 2 10 if ($field eq '') { }
2 8 elsif ($field eq '_NAME') { }
2 6 elsif ($field eq '_GID') { }
2 4 elsif ($field eq '_GCOS') { }
2 2 elsif ($field eq '_DIR') { }
2 0 elsif ($field eq '_SHELL') { }
494 0 0 unless defined $$o{'env'}{$var}
499 0 86 if ($str =~ /^\'(.*)\'$/)
502 0 86 if ($str =~ /\`(.*)\`$/)
519 0 77 if ($k eq 'MODULE_PATH')
523 0 77 unless $k =~ /^[\w-]+$/
525 0 77 if $k eq &STATE or $k eq &DIMENSION or $k eq 'ENVY_BASE' or $k eq 'ENVY_LINKBASE'
534 0 31 unless $k
535 0 31 if $k eq 'PATH' or $k eq 'MANPATH'
537 26 5 if (not $reverse) { }
538 0 26 if not $force and exists $$o{'env'}{$k}
553 0 46 unless $k
565 33 13 if defined $$o{'env'}{$k}
572 19 27 $reverse ? :
573 42 4 $prepend ? :
576 20 26 if ($k eq 'PATH') { }
581 11 9 if $prepend and not $reverse
584 0 12 if (not $reverse and exists $delta{$p} and not exists $ign{$p})
588 9 21 if delete $delta{$p} or exists $ign{$p}
592 1 1 unless $prepend or $reverse
594 0 20 if $has_dot
596 14 12 if $prepend and not $reverse
598 0 25 if (not $reverse and exists $delta{$p})
602 13 12 if delete $delta{$p}
605 1 1 unless $prepend or $reverse
607 37 9 if (@now) { }
619 8 6 $how > 0 ? :
0 14 $how == 0 ? :
624 0 36 if @_ != 4
625 0 36 unless $$o{'transaction'}
626 0 36 if $$o{'errors'} > 5
628 0 36 if $Envy::DB::Loop > 100
631 0 36 if $how == 0 and not $$o{'loaded'}{$e}
634 1 12 if $how < 0 and not $$o{'loaded'}{$e} and $$o{'dimen'}{$e}
637 0 36 unless $Envy::DB::Path
639 1 35 if ($how < 0 and $o->get_refcnt($e) == 0)
640 1 0 unless $$o{'unload_all'}
652 0 35 unless open $fh, $Envy::DB::Path
660 61 35 if $seen_stuff
662 0 21 if ($how > 0 and $o->is_first and not $o->is_first($e))
675 40 112 unless length $l
677 77 35 $how >= 0 ? :
681 0 112 if ($l =~ /^(alpha|beta|deprecated)$/) { }
0 112 elsif ($l =~ s/^(echo|error)\s?//) { }
0 112 elsif ($l =~ s/^desc(ription)?\s+//) { }
0 112 elsif ($l =~ /^require\s+Envy\s+([\d\.]+)$/) { }
16 96 elsif ($l =~ s/^dimension\s+//) { }
14 82 elsif ($l =~ s/^require\s+//) { }
0 82 elsif ($l =~ s/^(c)?sh_load\s+//) { }
50 32 elsif ($l =~ /^([\w-]+) (\+\=|\=\+) (.*)$/x) { }
32 0 elsif ($l =~ /^([\w-]+) (:)?= (.*)$/x) { }
682 0 0 if $mod and $how >= 0
685 0 0 if ($mod and $how >= 0)
687 0 0 if ($1 eq 'echo') { }
698 0 0 if (not $$d{$e}) { }
705 0 0 if $mod and $v > $Envy::DB::VERSION
710 0 16 if $seen_stuff and $how >= 0
712 0 16 unless $l =~ /^[\w-]+$/
714 0 16 if $l =~ /(release)/ or $l =~ /(version)/
721 0 14 unless $str =~ m[^[-\w./]+$]
729 0 0 if ($envy_file)
738 2 48 if ($got[0] eq &PATH)
739 0 2 if ($is_first)
742 0 2 if ($got[1])
747 46 4 if $mod
749 2 48 if $got[0] eq &PATH
754 0 32 if (not $is_first and $got[0] eq &PATH)
757 31 1 if $mod
759 6 26 if $got[0] eq &PATH
767 23 12 if ($how >= 0) { }
770 0 106 if $$o{'errors'} > 5
772 21 2 if ($how)
773 0 21 if ($is_first and not $$o{'env'}{&PATH})
776 0 21 if ($swap and $swap != 1) { }
785 0 46 if $$o{'errors'} > 5
787 5 7 if ($how < -1) { }
796 12 23 $how < 0 ? :
806 1 17 if ($reverse and $o->is_first($e)) { }
809 3 14 $reverse ? :
810 2 15 if not $reverse and $$o{'loaded'}{$e}
812 3 14 $reverse ? :
826 4 1 unless $$o{'loaded'}{$e}
827 1 0 unless $o->is_first($e)
841 0 0 if $$o{'transaction'}
845 0 0 if (@stat and $stat[7] > 262144)
846 0 0 unless rename $file, "$file.old"
850 0 0 unless sysopen $LOG, $file, &O_WRONLY | &O_APPEND | &O_CREAT, 438
860 0 18 if $$o{'transaction'}
861 0 18 if $$o{'errors'}
870 0 17 if @_ == 2
879 0 0 unless keys %{$$o{'desc'};}
902 0 0 if $$o{'where'} ne 'shell'