Pod::E...Munger(3pm)
π NAME π
ok so Pod::Elemental::PerlMunger β it's literally a thing that takes a string of Perl and rewrites its documentation. that's the whole vibe. a Perl-doc glow-up machine π¦
β¨ VERSION β¨
version 0.200007 β yes bestie, she's been through some things and she's thriving π
πΈ OVERVIEW πΈ
ok so here's the tea. this is a role β meaning you don't just use it, you include it in classes that rewrite the documentation of a Perl document. the whole job is: strip out all the Pod, munge it (yes that's the technical term, it's giving mad scientist π§ͺ), and stick it back into the Perl.
the only method that matters here is munge_perl_string, and heads up β the interface you implement is different from the interface that gets exposed. iconic of her honestly.
when you're calling the munge_perl_string method, you pass arguments like this:
$object->munge_perl_string($perl_string, \%arg);
$perl_string should be a character string containing Perl source code. yes, a character string, don't play with her π
%arg may contain any input for the underlying procedure. the Defined keys for %arg are:
filenameβ the name of the file whose contents are being munged; it's optional, and it's only used for error messages. lowkey just there so your errors have a name to point at π«Άno_strip_bomβ if given, the BOM character (U+FEFF) won't be stripped from the input. probably best to leave this one off, ngl π
the method will return a character string containing the rewritten and combined document. slay.
now for the other side. classes including this role must implement a munge_perl_string that expects to be called like this:
$object->munge_perl_string(\%doc, \%arg);
and %doc will have two entries:
ppiβ aPPI::Documentof the Perl document with all its Pod removedpodβ aPod::Elemental::Documentwith no transformations yet performed
this munge_perl_string method should return a hashref in the same format as %doc. no cap, same shape going out as coming in π«
π PERL VERSION π
this library should run on perls released even a long time ago. it should work on any version of perl released in the last five years. she's got range π
although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. the version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. so don't come for her about backwards compat, fr fr π
π ATTRIBUTES π
replacer
the replacer is either a method name or code reference used to produces PPI elements used to replace removed Pod. (yes, "produces", we're quoting her verbatim, she said what she said π )
by default, it's replace_with_nothing, 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. so like, the numbers shift. that's the tradeoff bestie π
see also replace_with_comment and replace_with_blank.
if no further code follows the Pod being replaced, post_code_replacer is used instead. plot twist π
post_code_replacer
this attribute is used just like replacer, 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. it's giving strategic laziness and honestly? valid π
π₯ METHODS π₯
replace_with_nothing
this method returns nothing. it's the default replacer. it's not very interesting. she's the plain iced coffee of replacers β does the job, no notes β
replace_with_comment
this replacer replaces removed Pod elements with a comment containing their text. in other words:
=head1 A header!
This is great!
=cut
...is replaced with:
# =head1 A header!
#
# This is great!
#
# =cut
the way she just wraps the whole thing in # and calls it a day πβ¨
replace_with_blank
this replacer replaces removed Pod elements with vertical whitespace of equal line count. in other words:
=head1 A header!
This is great!
=cut
...is replaced with five blank lines. literally just vibes and empty space π«§ (count them: five. she's precise.)
π AUTHOR π
Ricardo SIGNES <cpan@semiotic.systems>
π CONTRIBUTORS π
- Christopher J. Madsen <perl@cjmweb.net>
- Dave Rolsky <autarch@urth.org>
- Karen Etheridge <ether@cpan.org>
- perlancar (on PC, Bandung) <perlancar@gmail.com>
- Ricardo Signes <rjbs@semiotic.systems>
look at this friend group. the way they all showed up for her π₯Ήπ«Ά
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2022 by Ricardo SIGNES.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
ok that's the whole page bestie!! π this little masterpiece lives in the User Contributed Perl Documentation, it's Pod::E...Munger(3pm) (the long name got the βοΈ treatment in the header, you know how it is), and this specific rendition is version 0.200007, dated 2023-01-05, running on perl v5.36.0. go forth and munge, periodt π
β¨
π¦ where this page comes from
- debian bookworm: libpod-elemental-perlmunger-perl 0.200007-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libpod-elemental-perlmunger-perl 0.200007-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libpod-elemental-perlmunger-perl 0.200007-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libpod-elemental-perlmunger-perl 0.200007-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpod-elemental-perlmunger-perl 0.200007-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms