script/text2html

filter: Statementstmt 95.0% 19 / 20 Branchbran 70.0% 7 / 10 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 83.3% 30 / 36 CC 1 SCAR 0.0
CC
1
Cov
85%
BEGIN
1.0
CRAP 1.0
« lib/HTML/FromText.pm ↑ Summary
1 #!/usr/local/bin/perl
2 # -*- cperl -*-
3 1 ▶use HTML::FromText;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 # PODNAME: text2html
5 # ABSTRACT: convert plain text to HTML
6  
7 1 my %options, @files;
8  
9 1 my $options_done = 0;
10 1 ▶while ( $_ = shift @ARGV ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ = shift @ARGV) 2 1 3
11 2 ▶ if ( /^--\w/ && ! $options_done ) {
Branch: 2 branches
BranchTrueFalseTotal
if (/^--\w/ and not $options_done) { } 1 1 2
elsif (/^--$/) { } 0 1 1
Condition66%2/3
/^--\w/ and not $options_done
!ll&&!rl&&r
101
MC/DC50%1/2
/^--\w/ and not $options_done
/^--\w/ not $options_done
Truth table66%2/3
A and not(B)
A= /^--\w/B= not $options_done
ABresult
0X0
100
111
12 1 s/^--//;
13 1 my ($option, $val) = split /=/, $_, 2;
14 1 ▶ $val = 1 unless defined $val;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $val 1 0 1
15 1 $options{$option} = $val;
16 } elsif ( /^--$/ ) {
17 0 $options_done = 1;
18 } else {
19 1 push @files, $_;
20 }
21 }
22  
23 1 @ARGV = @files;
24  
25 my $html = text2html
26 1 do {undef $/; <>},
27 %options;
28  
29 1 ▶$html .= "\n" unless $html =~ /\n$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $html =~ /\n$/ 0 1 1
30  
31 1 print $html;
32  
33 1 exit 0;
34  
35 __END__
« lib/HTML/FromText.pm ↑ Summary