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.200006
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

ATTRIBUTES

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

METHODS

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

AUTHOR

110       Ricardo SIGNES <rjbs@cpan.org>
111

CONTRIBUTORS

113       •   Christopher J. Madsen <perl@cjmweb.net>
114
115       •   Dave Rolsky <autarch@urth.org>
116
117       •   Karen Etheridge <ether@cpan.org>
118
119       •   perlancar (on PC, Bandung) <perlancar@gmail.com>
120
122       This software is copyright (c) 2016 by Ricardo SIGNES.
123
124       This is free software; you can redistribute it and/or modify it under
125       the same terms as the Perl 5 programming language system itself.
126
127
128
129perl v5.34.0                      2022-01-21     Pod::Elemental::PerlMunger(3)
Impressum