Branch Coverage

/root/.cpan/build/Text-Starfish-1.37-0/blib/lib/Text/Starfish.pm
Criterion Covered Total %
branch 258 466 55.3


line true false branch
57 2 0 if (/^-infile=(.*)$/) { }
0 0 elsif (/^-copyhooks$/) { }
62 0 47 if ($copyhooks)
63 0 0 unless ref $main::Star eq 'Text::Starfish'
73 47 0 unless $copyhooks
82 33 92 if (/^-e=?/) { }
2 90 elsif (/^-mode=/) { }
27 63 elsif (/^-o=/) { }
17 46 elsif (/^-replace$/) { }
0 46 elsif (/^-v$/) { }
90 2 43 if (defined $sf->{'NEW_FILE_MODE'} and $sf->{'NEW_FILE_MODE'} =~ /^0/)
101 1 1 unless defined $sf
112 0 2 if (/^-replace$/) { }
0 2 elsif (/^-noreplace$/) { }
0 2 elsif (/^-require$/) { }
2 0 elsif (not /^-/ and $infile eq '') { }
122 1 1 if ($sf->{'INFILE'} eq '' or not -r $sf->{'INFILE'})
123 0 1 if ($require)
135 0 45 if (defined $self->{'REPLACE'} and not defined $self->{'OUTFILE'})
149 27 19 exists $self->{'OUTFILE'} ? :
152 19 27 if (not defined $self->{'OUTFILE'}) { }
0 27 elsif ($FileCount > 1) { }
24 3 elsif (not -f $self->{'OUTFILE'}) { }
172 0 45 if ($outfileExternal ne '' and $outfileExternal ne $self->{'OUTFILE'})
177 26 19 if ($FileCount == 1 and defined $self->{'OUTFILE'})
179 23 3 if (not -f $self->{'OUTFILE'}) { }
0 3 elsif (defined $self->{'NEW_FILE_MODE'}) { }
182 2 21 if (defined $self->{'NEW_FILE_MODE'}) { }
191 40 5 if ($ExistingText ne $self->{'Out'}) { }
0 5 elsif (defined $self->{'NEW_FILE_MODE'}) { }
192 24 16 if (defined $self->{'OUTFILE'}) { }
198 1 23 if (($mode & 128) == 0 and defined $self->{'NEW_FILE_MODE'}) { }
200 1 0 if ($FileCount == 1) { }
204 23 0 if ($FileCount == 1) { }
210 0 16 if defined $self->{'NEW_FILE_MODE'}
214 0 0 if (defined $self->{'OUTFILE'}) { }
227 27 0 if ($hook->{'ht'} eq 'regex')
232 25 2 if $self->{'REPLACE'}
233 0 2 if $r eq ''
248 723 47 if ($self->{'ttype'} > -1) { }
250 27 696 if ($hook->{'ht'} eq 'regex') { }
507 189 elsif (@{$self->{'args'};}) { }
268 7 46 if ($self->{'CurrentLoop'} < $self->{'Loops'})
270 1 6 if ($self->{'REPLACE'})
275 6 0 if ($savedcontent ne $self->{'Out'})
282 2 44 if (defined $self->{'Final'})
290 6 40 if (defined $self->{'macrosdefined'})
294 10 0 if ($s =~ /\n/)
296 10 0 if ($s) { }
307 20 750 if ($self->{'REPLACE'} and $self->{'IgnoreOuter'}) { }
316 93 3208 if (ref $subs eq 'Regexp') { }
317 25 68 if ($str =~ /$subs/) { }
330 53 770 if ($self->{'data'} eq '') { }
342 3040 2172 if (exists $self->{'hook'}[$ttype]{'begin'}) { }
345 2779 261 unless $j != -1 and $j <= $i1
347 261 0 if ($self->{'hook'}[$ttype]{'end'} ne '') { }
349 8 253 if -1 == $j2
352 8 245 if $j == $i1 and $i2 <= $j2
358 1191 981 unless @args
360 430 551 unless $j < $i1
368 47 723 if ($self->{'ttype'} == -2) { }
371 534 189 if (@{$self->{'args'};}) { }
393 723 0 if (defined $self->{'OutDelimiters'})
395 26 697 if ($self->{'data'} =~ /^\Q$b1\E(\d*)\Q$b2\E.*?\Q$e1\E\1\Q$e2\E/s)
407 13 261 unless defined $code
409 1 8 if ($Star->{'CurrentLoop'} == 1)
2 3 if ($uspj =~ /\\n$/)
410 0 274 if ($@)
425 83 44 if (defined $self->{'CodePreparation'} and $self->{'CodePreparation'})
436 61 65 if ($self->{'REPLACE'})
437 31 34 if ($main::O ne '')
444 34 0 if defined $self->{'OutDelimiters'}
446 6 28 if (index($out, $e) != -1)
447 6 6 if index($out, $e) == -1
448 0 6 if $i > 1000000
459 0 0 if (defined $self->{'CodePreparation'} and $self->{'CodePreparation'})
470 0 0 if ($self->{'REPLACE'})
471 0 0 if ($main::O ne '')
473 0 0 if ($pref =~ /^(\s+)#/) { }
0 0 elsif ($c =~ /^(\s+)#/m) { }
477 0 0 unless rindex($out, "\n") == length($out) - 1
493 8 0 if (defined $self->{'CodePreparation'} and $self->{'CodePreparation'})
504 0 8 if ($self->{'REPLACE'}) { }
1 7 elsif ($main::O eq '') { }
511 0 7 if (index($main::O, $e) != -1)
512 0 0 if index($main::O, $e) == -1
513 0 0 if $i > 1000000
531 0 1 if $self->{'REPLACE'}
532 0 1 if $main::O eq ''
540 1 1 if $self->{'REPLACE'}
551 164 0 if ($self->{'REPLACE'})
562 0 1 if ($self->{'CurrentLoop'} > 1)
564 0 1 unless $data =~ /^.+/
565 0 1 unless $&
566 0 1 if $self->{'ForbidMacro'}{$&}
577 0 2 if ($self->{'CurrentLoop'} > 1)
579 0 2 unless $data =~ /^.+/
580 0 2 unless $&
581 0 2 if $self->{'ForbidMacro'}{$&}
588 0 2 unless ref $self eq 'Text::Starfish'
594 0 2 if ($self->{'CurrentLoop'} > 1)
596 0 2 unless $data =~ /^.+/
597 0 3 unless $&
598 0 3 if defined $self->{'ForbidMacro'}{$&}
604 0 3 unless ref $self eq 'Text::Starfish'
610 0 3 if ($self->{'CurrentLoop'} > 1)
612 0 3 unless $data =~ /^.+/
613 0 2 unless $&
614 0 2 if (defined $self->{'Macros'}{$&} or $self->{'ForbidMacro'}{$&})
623 0 8 unless ref $self eq 'Text::Starfish'
629 4 4 if ($self->{'CurrentLoop'} < 2 or $self->{'HideMacros'})
632 0 4 unless $data =~ /^.+/
633 0 4 unless $&
640 0 14 unless ref $self eq 'Text::Starfish'
646 2 12 if ($self->{'CurrentLoop'} < 2 or $self->{'HideMacros'})
649 0 12 unless $data =~ /^.+/
650 0 12 unless $&
651 0 12 unless defined $self->{'Macros'}{$&}
657 0 0 unless ref $self eq 'Text::Starfish'
663 0 0 if ($self->{'CurrentLoop'} < 2)
665 0 0 unless $data =~ /^.+/
666 0 0 unless $&
667 0 0 unless defined $self->{'Macros'}{$&}
673 0 0 unless ref $self eq 'Text::Starfish'
679 0 0 if ($self->{'CurrentLoop'} < 2)
681 0 0 unless $data =~ /^.+/
682 0 1 unless $&
683 0 1 unless defined $self->{'Macros'}{$&}
690 0 3 unless ref $self eq 'Text::Starfish'
696 0 2 unless $data =~ /^.+/
697 0 2 unless $&
703 0 4 unless ref $self eq 'Text::Starfish'
709 0 4 unless $data =~ /^.+/
710 0 4 unless $&
716 0 0 unless ref $self eq 'Text::Starfish'
722 0 0 unless $data =~ /^.+/
723 0 0 unless $&
729 0 0 unless ref $self eq 'Text::Starfish'
735 0 0 if ($self->{'CurrentLoop'} < 2)
736 0 0 unless $data =~ /^.+/
737 0 0 unless $&
738 0 0 unless defined $self->{'Macros'}{$&}
745 0 0 unless ref $self eq 'Text::Starfish'
751 0 0 unless $data =~ /^.+/
752 0 0 unless $&
755 0 1 if $self->{'ForbidMacro'}{$mn}
756 0 1 unless (defined $self->{'Macros'}{$mn})
762 0 4 unless ref $self eq 'Text::Starfish'
768 1 3 unless $data =~ /^.+/
769 0 3 unless $&
771 0 11 if $self->{'ForbidMacro'}{$mn}
772 4 3 unless (defined $self->{'Macros'}{$mn})
814 0 184 if (ref $self ne 'Text::Starfish')
816 89 96 if ($#_ == -1)
817 0 93 if (defined $self->{'STYLE'} and $self->{'STYLE'} ne '') { }
822 6 91 if ($f =~ /\.(html\.sfish|sf)$/i) { }
825 7 83 if ($f =~ /\.html?/i) { }
5 78 elsif ($f =~ /\.(?:la)?tex$/i) { }
12 66 elsif ($f =~ /\.java$/i) { }
3 63 elsif ($f =~ /^[Mm]akefile/) { }
0 65 elsif ($f =~ /\.ps$/i) { }
1 64 elsif ($f =~ /\.py$/i) { }
838 5 91 if ($s eq 'latex' or $s eq 'TeX')
839 17 77 if (defined $self->{'Style'} and $s eq $self->{'Style'})
858 44 33 if ($s eq 'perl') { }
4 29 elsif ($s eq 'makefile') { }
1 28 elsif ($s eq 'python') { }
12 16 elsif ($s eq 'java') { }
8 8 elsif ($s eq 'tex') { }
2 6 elsif ($s eq 'html.sfish') { }
6 0 elsif ($s eq 'html') { }
0 0 elsif ($s eq 'ps') { }
928 0 6 if (ref $self ne 'Text::Starfish')
933 6 0 if (ref $fun eq '')
934 1 5 if ($fun eq 'ignore') { }
5 0 elsif ($fun eq 'echo') { }
937 0 6 $lc eq '' ? :
944 0 2 if (ref $self ne 'Text::Starfish')
947 0 2 if $#_ > 0
953 4 0 if (ref $self ne 'Text::Starfish')
955 0 4 if scalar @_ != 4
960 8 3 if (ref $self ne 'Text::Starfish')
965 7 4 if ($ht eq 'regex') { }
4 0 elsif ($ht eq 'be') { }
968 0 7 if (ref $replace eq '' and $replace eq 'comment') { }
7 0 elsif (ref $replace eq 'CODE') { }
978 0 4 if ($#_ > -1)
989 20 24 if ($#_ == 2) { }
24 0 elsif ($#_ == 1 and ref $_[0] eq 'Regexp') { }
991 5 15 if ($fun eq 'default') { }
2 13 elsif ($fun eq 'ignore') { }
1 12 elsif ($fun eq 'echo') { }
1 11 elsif (ref $fun eq 'CODE') { }
1002 3 0 if ($self->{'REPLACE'})
1017 0 20 if $@
1020 4 20 if (ref $replace eq '' and $replace eq 'comment') { }
20 0 elsif (ref $replace eq 'CODE') { }
1034 4 1 if (ref $self ne 'Text::Starfish')
1038 5 0 if ($ht eq 'be') { }
1042 5 14 if ($h->{'begin'} eq $b and $h->{'end'} eq $e) { }
1066 0 3 unless ref $f eq 'CODE'
1067 3 0 unless (defined $self->{'Final'})
1074 6 6 if $self->{'CurrentLoop'} > 1
1075 6 0 if $self->{'Loops'} < 2
1135 0 4 unless $f =~ /\b$l=(.*(?:(?<=\\)\n.*)*)/
1170 0 3 if ($& eq "\n") { }
1183 0 49 unless open F, "<$f"
1186 0 49 wantarray ? :
1192 0 102 unless open F, ">$f"
1193 23 79 unless @_
1201 0 0 unless open F, ">>$f"
1202 0 0 unless @_
1217 0 0 if ($arg =~ /^file=/)
1218 0 0 unless open F, $f
1225 0 0 if ($arg =~ /^([ \t\r]*(#.*)?\n)+/)
1226 0 0 if $arg eq ''
1227 0 0 if ($arg =~ /([ \t\r]*\n){2,}/) { }
1231 0 0 if ($record =~ /^[ \t]*#.*\n/)
1233 0 0 unless $record =~ /^[ \t]*([^\n:]*?)[ \t]*:/
1236 0 0 if $k eq ''
1238 0 0 if ($record =~ /^(.*?)\\(\r?\n)/) { }
0 0 elsif ($record =~ /^.*?\r?\n[ \t]/) { }
0 0 elsif ($record =~ /^(.*?)\r?\n/) { }
1243 0 0 if (exists $r->{$k})
1252 0 0 wantarray ? :
1258 0 0 @_ ? :
1259 0 0 if ($self->{'Loops'} < 2)
1264 0 0 @_ ? :
1269 0 0 @_ ? :
1279 0 0 unless -e 'starfish.conf'
1286 0 0 unless chdir $d
1290 0 0 unless chdir $currdir
1304 0 0 if grep {$_ eq $d;} @Text::Starfish::DirGenerateIfNeeded