File Coverage

blib/lib/Pod/Wrap.pm
Criterion Covered Total %
statement 26 26 100.0
branch 4 4 100.0
condition n/a
subroutine 7 7 100.0
pod 0 3 0.0
total 37 40 92.5


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2             # $Id: Wrap.pm,v 1.3 2004/01/08 03:20:16 nothingmuch Exp $
3              
4             package Pod::Wrap;
5              
6 1     1   32630 use strict;
  1         3  
  1         40  
7 1     1   6 use warnings;
  1         3  
  1         35  
8              
9 1     1   1120 use Text::Wrap;
  1         3750  
  1         73  
10 1     1   9 use base 'Pod::Parser';
  1         1  
  1         506  
11              
12             our $VERSION = 0.01;
13              
14             sub begin_input {
15 76     76 0 55961210 my $self = shift;
16            
17 76         3031 $self->parseopts( # we need some special options:
18             '-want_nonPODs' => 1, # want the perl code
19             '-process_cut_cmd' => 9, # want to preserve cuts so pod is properly terminated
20             );
21            
22 76         11118 return undef;
23             }
24              
25             sub preprocess_paragraph { # used to catch
26 9847     9847 0 1680550 my $self = shift;
27 9847         19915 my $text = shift;
28            
29 9847         65372 my $fh = $self->output_handle;
30 9847 100       104981 print $fh $text if $self->cutting(); # this is not pod, so we print it.
31              
32 9847         550290 return $text;
33             }
34              
35             sub textblock {
36 5067     5067 0 7933 my $self = shift;
37 5067         11608 my $text = shift;
38            
39 5067         24078 my $fh = $self->output_handle;
40 5067 100       24944 if ($text =~ /^=/mg){ # when 'command' is not defined, commands are passed as paragraphs to here. Which means we don't have to recreate them.
41 2320         107520 print $fh $text; # we just don't wrap them.
42             } else {
43 2747         9581 print $fh wrap('','',$text), "\n"; # wrap 'regular' text, without indenting, and end with another newline..
44             }
45             }
46              
47             # sub new { $_[0]->SUPER::new() } # force no arguments to new?
48             # sub verbatim { print $_[1] } # will be printed automatically if not defined
49             # sub command { my $self = shift; print "=", $_[0], " ", $_[1], "\n" } # ce n'est past bien
50              
51             1; # keep your mother happy
52              
53             __END__