1Pod::Elemental::PerlMunUgseerr(3C)ontributed Perl DocumePnotda:t:iEolnemental::PerlMunger(3)
2
3
4

NAME

6       Pod::Elemental::PerlMunger - a thing that takes a string of Perl and
7       rewrites its documentation
8

VERSION

10       version 0.200007
11

OVERVIEW

13       This role is to be included in classes that rewrite the documentation
14       of a Perl document, stripping out all the Pod, munging it, and
15       replacing it into the Perl.
16
17       The only relevant method is "munge_perl_string", which must be
18       implemented with a different interface than will be exposed.
19
20       When calling the "munge_perl_string" method, arguments should be passed
21       like this:
22
23         $object->munge_perl_string($perl_string, \%arg);
24
25       $perl_string should be a character string containing Perl source code.
26
27       %arg may contain any input for the underlying procedure.  Defined keys
28       for %arg are:
29
30       filename
31           the name of the file whose contents are being munged; optional,
32           used for error messages
33
34       no_strip_bom
35           If given, the BOM character (U+FEFF) won't be stripped from the
36           input.  Probably best to leave this one off.
37
38       The method will return a character string containing the rewritten and
39       combined document.
40
41       Classes including this role must implement a "munge_perl_string" that
42       expects to be called like this:
43
44         $object->munge_perl_string(\%doc, \%arg);
45
46       %doc will have two entries:
47
48         ppi - a PPI::Document of the Perl document with all its Pod removed
49         pod - a Pod::Elemental::Document with no transformations yet performed
50
51       This "munge_perl_string" method should return a hashref in the same
52       format as %doc.
53

PERL VERSION

55       This library should run on perls released even a long time ago.  It
56       should work on any version of perl released in the last five years.
57
58       Although it may work on older versions of perl, no guarantee is made
59       that the minimum required version will not be increased.  The version
60       may be increased for any reason, and there is no promise that patches
61       will be accepted to lower the minimum required perl.
62

ATTRIBUTES

64   replacer
65       The replacer is either a method name or code reference used to produces
66       PPI elements used to replace removed Pod.  By default, it is
67       "replace_with_nothing", which just removes Pod tokens entirely.  This
68       means that the line numbers of the code in the newly-produced document
69       are changed, if the Pod had been interleaved with the code.
70
71       See also "replace_with_comment" and "replace_with_blank".
72
73       If no further code follows the Pod being replaced, "post_code_replacer"
74       is used instead.
75
76   post_code_replacer
77       This attribute is used just like "replacer", and defaults to its value,
78       but is used for building replacements for Pod removed after the last
79       hunk of code.  The idea is that if you're only concerned about altering
80       your code's line numbers, you can stop replacing stuff after there's no
81       more code to be affected.
82

METHODS

84   replace_with_nothing
85       This method returns nothing.  It's the default "replacer".  It's not
86       very interesting.
87
88   replace_with_comment
89       This replacer replaces removed Pod elements with a comment containing
90       their text.  In other words:
91
92         =head1 A header!
93
94         This is great!
95
96         =cut
97
98       ...is replaced with:
99
100         # =head1 A header!
101         #
102         # This is great!
103         #
104         # =cut
105
106   replace_with_blank
107       This replacer replaces removed Pod elements with vertical whitespace of
108       equal line count.  In other words:
109
110         =head1 A header!
111
112         This is great!
113
114         =cut
115
116       ...is replaced with five blank lines.
117

AUTHOR

119       Ricardo SIGNES <cpan@semiotic.systems>
120

CONTRIBUTORS

122       •   Christopher J. Madsen <perl@cjmweb.net>
123
124       •   Dave Rolsky <autarch@urth.org>
125
126       •   Karen Etheridge <ether@cpan.org>
127
128       •   perlancar (on PC, Bandung) <perlancar@gmail.com>
129
130       •   Ricardo Signes <rjbs@semiotic.systems>
131
133       This software is copyright (c) 2022 by Ricardo SIGNES.
134
135       This is free software; you can redistribute it and/or modify it under
136       the same terms as the Perl 5 programming language system itself.
137
138
139
140perl v5.36.0                      2023-01-20     Pod::Elemental::PerlMunger(3)
Impressum