BlendedCode/Blender.pm

filter: Statementstmt 100% 35 / 35 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 3 totaltotal 93.7% 45 / 48 CC 2 SCAR 2.0
CC
2
Cov
100%
preprocess_paragraph
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« BlendedCode.pm ↑ Summary
1 package Pod::Simple::XHTML::BlendedCode::Blender;
2  
3 # This module blends the code into the pod in such a way that
4 # Pod::Simple::XHTML::Blended can use it.
5 # Think of it as a "pod+code->pod" parser.
6  
7 4 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use parent 0.223 qw(Pod::Parser);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use PPI::HTML 1.08 qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 our $VERSION = '1.000';
14 4 $VERSION =~ s/_//ms;
15  
16 4 ▶sub initialize {
Subroutine initialize: called CC=1 SCAR=0.0
Pod undocumented
17 4 my $self = shift;
18 4 $self->{highlighter} = PPI::HTML->new();
19 4 return $self->SUPER::initialize();
20 }
21  
22 117 ▶sub preprocess_paragraph {
Subroutine preprocess_paragraph: called CC=2 SCAR=6.9
Pod undocumented
23 117 my ( $self, $text, $line_number ) = @_;
24  
25 117 my $html;
26  
27 117 ▶ if ( $self->cutting() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cutting) { } 29 88 117
28 29 $html = $self->{highlighter}->html( \$text );
29 29 $html =~ s{<br>}{}msg;
30 29 $html =~ s{\n\n}{\n}msg;
31 29 $html =~ s{\t}{&nbsp;&nbsp;&nbsp;&nbsp;}msg;
32 29 print { $self->output_handle() }
33 "=begin html\n\n<pre>\n$html</pre>\n\n=end html\n\n";
34 29 return q{};
35 } else {
36 88 return $text;
37 }
38 } ## end sub preprocess_paragraph
39  
40 36 ▶sub command {
Subroutine command: called CC=1 SCAR=0.0
Pod undocumented
41 36 my ( $self, $command, $text, $line_number, $pod_paragraph ) = @_;
42  
43 36 print { $self->output_handle() } $pod_paragraph->raw_text();
44 36 return;
45 }
46  
47 4 1; # Magic true value required at end of module
48  
49 __END__
« BlendedCode.pm ↑ Summary