1Pod::Wrap(3) User Contributed Perl Documentation Pod::Wrap(3)
2
3
4
6 Pod::Wrap - Wrap pod paragraphs, leaving verbatim text and code alone.
7
9 #!/usr/bin/perl
10
11 use strict;
12 use warnings;
13
14 use Pod::Wrap;
15
16 my $w = new Pod::Wrap;
17
18 unless (@ARGV) {
19 $w->parse_from_filehandle() # STDIN
20 } else {
21 $w->parse_from_file($_) for @ARGV;
22 }
23
25 This is a Pod::Parser subclass, based on Pod::Stripper. It parses perl
26 files, wrapping pod text, and leaving everything else intact. It prints
27 it's output to wherever you point it to (like you do with Pod::Parser
28 (and Pod::Stripper)).
29
31 new This is actually "new" in Pod::Parser.
32
33 All arguments to it are meaningless, as they are in Pod::Parser.
34
35 parse_from_filehandle
36 parse_from_file
37 These are actually "parse_from_filehandle" in Pod::Parser and
38 "parse_from_file" in Pod::Parser.
39
40 They will receive input and output as described therein.
41
42 They will invoke this parser class, which will filter the pod text,
43 wrapping the appropriate sections using Text::Wrap.
44
46 I prefer editing with tabs and soft wrapping.
47
48 Most people like getting documentation hard wrapped and with tabs
49 expanded.
50
51 The tabs are easy (Text::Tabs), but wrapping only the correct parts of
52 the pod is a little tricker. This module attempts to do this correctly,
53 by wrapping only what isn't a command, a verbatim example (indented
54 text), or actual Perl code.
55
56 PodMaster noted that I should see what perltidy has to offer. Turns out
57 that
58
59 What perltidy does not parse and format
60 ...
61 And, of course, it does not modify pod documents.
62
63 This drove me to release this tiny module.
64
66 The wrapping behavior is defined entirely by Text::Wrap.
67
68 No re-exporting is made, in order to minimize bugs. If you want to
69 import the variables Text::Wrap uses, do something like this:
70
71 use Pod::Wrap;
72 use Text::Wrap qw/$columns $huge/;
73
75 Welcome.
76
78 You can ask me.
79
81 Podmaster wrote Pod::Stripper. Even though the functionality of this
82 module is very limited, and is not really derived from Pod::Stripper, I
83 would have been too lazy to read Pod::Parser's docs without seeing
84 Pod::Stripper's code as an example first.
85
86 Bottom line, most of the work (the research) that was actually done is
87 not mine. Implementation wouldn't have happened if I hadn't known for
88 sure it's possible to get perl code, verbatim, out of a pod parser. And
89 I wouldn't have if I hadn't seen a working example.
90
92 You may not wrap pod files in any way without my explicit permission,
93 in writing.
94
95 Just kidding.
96
97 Copyright 2004 Yuval Kogman. All rights reserved.
98 This program is free software; you can redistribute it
99 and/or modify it under the same terms as Perl itself.
100
102 Yuval Kogman <nothingmuch@woobling.org>
103
105 Text::Wrap, Pod::Parser, Pod::Stripper, Perl::Tidy
106
107
108
109perl v5.32.0 2020-07-28 Pod::Wrap(3)