script/trac2html

filter: Statementstmt 100% 31 / 31 Branchbran 62.5% 5 / 8 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 83.9% 47 / 56 SCAR 0.0
CC
1
Cov
87%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Text/Trac/LinkResolver.pm ↑ Summary blib/lib/Text/Trac/Macro/HelloWorld.pm »
1 #!/usr/bin/env perl
2 44 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 44 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 44 ▶use Text::Trac ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 44 ▶use Getopt::Long qw(GetOptions);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 44 ▶use Path::Tiny qw(path);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 44 my ($infile, $outfile);
10 44 my $url = '';
11 44 my $class;
12 my $span;
13 44 my $id;
14 44 my $force;
15  
16 44 ▶GetOptions(
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions("infile=s", \$infile, "outfile=s", \$outfile, "url=s", \$url, "class", \$class, "span", \$span, "id", \$id, "force", \$force) or usage() 0 44 44
17 'infile=s' => \$infile,
18 'outfile=s' => \$outfile,
19 'url=s' => \$url,
20 'class' => \$class,
21 'span' => \$span,
22 'id' => \$id,
23 'force' => \$force,
24 ) or usage();
25 44 ▶usage() if not $infile or not $outfile;
Branch: 1 branch
BranchTrueFalseTotal
unless $infile and $outfile 4 40 44
Condition66%2/3
$infile and $outfile
!ll&&!rl&&r
4040
MC/DC50%1/2
$infile and $outfile
$infile $outfile
Truth table66%2/3
A and B
A= $infileB= $outfile
ABresult
0X0
100
111
26 40 ▶die "Infile '$infile' does not exist.\n" if not -e $infile;
Branch: 1 branch
BranchTrueFalseTotal
unless -e $infile 0 40 40
27 40 ▶die "Outfile '$outfile' already exists.\n" if -e $outfile and not $force;
Branch: 1 branch
BranchTrueFalseTotal
if -e $outfile and not $force 0 40 40
Condition33%1/3
-e $outfile and not $force
!ll&&!rl&&r
4000
MC/DC0%0/2
-e $outfile and not $force
-e $outfile not $force
Truth table33%1/3
A and not(B)
A= -e $outfileB= not $force
ABresult
0X0
100
111
28  
29 40 main();
30 40 exit;
31  
32  
33 sub main {
34 40 ▶ my $parser = Text::Trac->new(
Subroutine main: called CC=1 SCAR=0.0
35 trac_url => $url,
36 class => $class,
37 span => $span,
38 id => $id,
39 # disable_links => [ qw( changeset ticket ) ],
40 );
41 40 $parser->parse( path($infile)->slurp_utf8 );
42 40 path($outfile)->spew_utf8( $parser->html );
43 }
44  
45  
46 sub usage {
47 4 ▶ print <<"END_USAGE";
Subroutine usage: called CC=1 SCAR=0.0
48 Usage: $0
49 --infile filename (File in Trac wiki format)
50 --outfile filename (The html file to generate)
51  
52 --url http://... ()
53 --class Include class="" in the HTML tags.
54 --span Include <span></span>
55 --id Include id="" in the HTML tags.
56 --force Overwrite exisiting html file.
57 END_USAGE
58 4 exit;
59 }
60  
« blib/lib/Text/Trac/LinkResolver.pm ↑ Summary blib/lib/Text/Trac/Macro/HelloWorld.pm »