lib/Pod/Wrap/Pretty.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 32 / 32 CC 2 SCAR 2.5
CC
2
Cov
100%
textblock
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« lib/Pod/Tidy.pm ↑ Summary scripts/podtidy »
1 # Copyright (C) 2005 Joshua Hoblitt
2 #
3 # $Id: Pretty.pm,v 1.4 2006/01/07 10:54:24 jhoblitt Exp $
4  
5 package Pod::Wrap::Pretty;
6  
7 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 21 ▶use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 21 $VERSION = '0.03';
11  
12 21 ▶use base qw( Pod::Wrap );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 21 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
15 21 ▶ use Text::Wrap;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 21 $Text::Wrap::columns = 80;
18 21 $Text::Wrap::tabstop = 4; # expand tabs to 4 spaces
19 21 $Text::Wrap::unexpand = undef; # permanently expand/remove tabs
20 21 $Text::Wrap::huge = 'overflow'; # don't break long words, eg. URLs
21 }
22  
23 sub textblock
24 122 ▶{
Subroutine textblock: called CC=2 SCAR=6.9
Pod documented
25 122 my ($self, $text) = @_;
26  
27 # is it a plain text paragraph?
28 122 ▶ if ($text !~ /^=/mg) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($text =~ /^=/gm) 69 53 122
29 # it is - remove all but the last newline so line the breaks are redone
30 69 $text =~ s|$/(?!\Z)| |g;
31 # trim whitespace from the end of the string
32 69 $text =~ s|\s*\z|$/|g;
33 }
34  
35 122 $self->SUPER::textblock($text, @_);
36 }
37  
38 21 1;
39  
40 __END__
« lib/Pod/Tidy.pm ↑ Summary scripts/podtidy »