.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Pod::Elemental::PerlMunger 3pm" .TH Pod::Elemental::PerlMunger 3pm "2021-01-05" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Pod::Elemental::PerlMunger \- a thing that takes a string of Perl and rewrites its documentation .SH "VERSION" .IX Header "VERSION" version 0.200006 .SH "OVERVIEW" .IX Header "OVERVIEW" This role is to be included in classes that rewrite the documentation of a Perl document, stripping out all the Pod, munging it, and replacing it into the Perl. .PP The only relevant method is \f(CW\*(C`munge_perl_string\*(C'\fR, which must be implemented with a different interface than will be exposed. .PP When calling the \f(CW\*(C`munge_perl_string\*(C'\fR method, arguments should be passed like this: .PP .Vb 1 \& $object\->munge_perl_string($perl_string, \e%arg); .Ve .PP \&\f(CW$perl_string\fR should be a character string containing Perl source code. .PP \&\f(CW%arg\fR may contain any input for the underlying procedure. Defined keys for \&\f(CW%arg\fR are: .IP "filename" 4 .IX Item "filename" the name of the file whose contents are being munged; optional, used for error messages .IP "no_strip_bom" 4 .IX Item "no_strip_bom" If given, the \s-1BOM\s0 character (U+FEFF) won't be stripped from the input. Probably best to leave this one off. .PP The method will return a character string containing the rewritten and combined document. .PP Classes including this role must implement a \f(CW\*(C`munge_perl_string\*(C'\fR that expects to be called like this: .PP .Vb 1 \& $object\->munge_perl_string(\e%doc, \e%arg); .Ve .PP \&\f(CW%doc\fR will have two entries: .PP .Vb 2 \& ppi \- a PPI::Document of the Perl document with all its Pod removed \& pod \- a Pod::Elemental::Document with no transformations yet performed .Ve .PP This \f(CW\*(C`munge_perl_string\*(C'\fR method should return a hashref in the same format as \&\f(CW%doc\fR. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "replacer" .IX Subsection "replacer" The replacer is either a method name or code reference used to produces \s-1PPI\s0 elements used to replace removed Pod. By default, it is \&\f(CW"replace_with_nothing"\fR, which just removes Pod tokens entirely. This means that the line numbers of the code in the newly-produced document are changed, if the Pod had been interleaved with the code. .PP See also \f(CW"replace_with_comment"\fR and \f(CW"replace_with_blank"\fR. .PP If no further code follows the Pod being replaced, \f(CW"post_code_replacer"\fR is used instead. .SS "post_code_replacer" .IX Subsection "post_code_replacer" This attribute is used just like \f(CW"replacer"\fR, and defaults to its value, but is used for building replacements for Pod removed after the last hunk of code. The idea is that if you're only concerned about altering your code's line numbers, you can stop replacing stuff after there's no more code to be affected. .SH "METHODS" .IX Header "METHODS" .SS "replace_with_nothing" .IX Subsection "replace_with_nothing" This method returns nothing. It's the default \f(CW"replacer"\fR. It's not very interesting. .SS "replace_with_comment" .IX Subsection "replace_with_comment" This replacer replaces removed Pod elements with a comment containing their text. In other words: .PP .Vb 1 \& =head1 A header! \& \& This is great! \& \& =cut .Ve .PP \&...is replaced with: .PP .Vb 5 \& # =head1 A header! \& # \& # This is great! \& # \& # =cut .Ve .SS "replace_with_blank" .IX Subsection "replace_with_blank" This replacer replaces removed Pod elements with vertical whitespace of equal line count. In other words: .PP .Vb 1 \& =head1 A header! \& \& This is great! \& \& =cut .Ve .PP \&...is replaced with five blank lines. .SH "AUTHOR" .IX Header "AUTHOR" Ricardo \s-1SIGNES\s0 .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Christopher J. Madsen .IP "\(bu" 4 Dave Rolsky .IP "\(bu" 4 Karen Etheridge .IP "\(bu" 4 perlancar (on \s-1PC,\s0 Bandung) .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2016 by Ricardo \s-1SIGNES.\s0 .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.