FormatText/Zen.pm

filter: Statementstmt 85.2% 29 / 34 Branchbran 25.0% 1 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 90.0% 9 / 10 Podpod 100% 2 / 2 totaltotal 77.3% 41 / 53 CC 4 SCAR 9.1
CC
4
Cov
75%
_make_run
6.0
program_version
4.1
BEGIN
1.0
CRAP 2.5
« FormatText/Netrik.pm ↑ Summary
1 # Copyright 2008, 2009, 2010, 2013, 2015 Kevin Ryde
2  
3 # HTML-FormatExternal is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License as published
5 # by the Free Software Foundation; either version 3, or (at your option) any
6 # later version.
7 #
8 # HTML-FormatExternal is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 # for more details.
12 #
13 # You should have received a copy of the GNU General Public License along
14 # with HTML-FormatExternal. If not, see <http://www.gnu.org/licenses/>.
15  
16 package HTML::FormatText::Zen;
17 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use HTML::FormatExternal;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 our @ISA = ('HTML::FormatExternal');
22  
23 1 our $VERSION = 26;
24  
25 1 ▶use constant DEFAULT_LEFTMARGIN => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use constant DEFAULT_RIGHTMARGIN => 80;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 # no input charset options
29 1 ▶use constant _WIDE_INPUT_CHARSET => 'entitize';
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 5 ▶sub program_full_version {
Subroutine program_full_version: called CC=1 SCAR=0.0
Pod documented
32 5 my ($self_or_class) = @_;
33 5 return $self_or_class->_run_version (['zen', '--version']);
34 }
35 2 ▶sub program_version {
Subroutine program_version: called CC=3 SCAR=14.2
Pod documented
36 2 my ($self_or_class) = @_;
37 2 my $version = $self_or_class->program_full_version;
38 2 ▶ if (! defined $version) { return undef; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $version) 2 0 2
39  
40 # eg. "zen version 0.2.3"
41 0 ▶ $version =~ /^zen version (.*)/i
Branch: 1 branch
BranchTrueFalseTotal
$version =~ /^zen version (.*)/i or $version =~ /^(.*)/ 0 0 0
42 or $version =~ /^(.*)/; # whole first line if format not recognised
43 0 return $1 . substr($version,0,0); # retain taintedness
44 }
45  
46 0 ▶sub _make_run {
Subroutine _make_run: not called CC=2 SCAR=17.9
47 0 my ($class, $input_filename, $options) = @_;
48  
49 # Is it worth enforcing/checking this ?
50 # Could use Encode.pm to convert the output without too much trouble.
51 #
52 # if (my $input_charset = $options->{'input_charset'}) {
53 # $input_charset =~ /^latin-?1$|^iso-?8859-1$/i
54 # or croak "Zen only accepts latin-1 input";
55 # }
56 # if (my $output_charset = $options->{'output_charset'}) {
57 # $output_charset =~ /^latin-?1$|^iso-?8859-1$/i
58 # or croak "Zen only produces latin-1 output";
59 # }
60  
61 # 'zen_options' not documented ...
62 return ([ 'zen', '-i', 'dump',
63 0 ▶ @{$options->{'zen_options'} || []},
Condition0%0/2
$options->{'zen_options'} || []
l!l
00
MC/DC0%0/1
$options->{'zen_options'} || []
$options->{'zen_options'}
Truth table0%0/2
A
A= $options->{'zen_options'}
Aresult
11
00
64 '--', # end of options
65 $input_filename,
66 ]);
67 }
68  
69 1 1;
70 __END__
« FormatText/Netrik.pm ↑ Summary