Pod::Elemental::PerlMunger - a thing that takes a string of Perl and rewrites its documentation
version 0.200000
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.
The only relevant method is munge_perl_string, which must be implemented with a different interface than will be exposed.
munge_perl_string
When calling the munge_perl_string method, arguments should be passed like this:
$object->munge_perl_string($perl_string, \%arg);
$perl_string should be a character string containing Perl source code.
$perl_string
%arg may contain any input for the underlying procedure. The only key with associated meaning is filename which may be omitted. If given, it should be the name of the file whose contents are being munged.
%arg
filename
The method will return a character string containing the rewritten and combined document.
Classes including this role must implement a munge_perl_string that expects to be called like this:
$object->munge_perl_string(\%doc, \%arg);
%doc will have two entries:
%doc
ppi - a PPI::Document of the Perl document with all its Pod removed pod - a Pod::Elemental::Document with no transformations yet performed
This munge_perl_string method should return a hashref in the same format as %doc.
The replacer is either a method name or code reference used to produces PPI elements used to replace removed Pod. By default, it is "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.
"replace_with_nothing"
See also "replace_with_comment" and "replace_with_blank".
"replace_with_comment"
"replace_with_blank"
This method returns nothing. It's the default "replacer". It's not very interesting.
"replacer"
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
This replacer replaces removed Pod elements with vertical whitespace of equal line count. In other words:
...is replaced with five blank lines.
Ricardo SIGNES <rjbs@cpan.org>
This software is copyright (c) 2014 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.
To install Pod::Elemental::PerlMunger, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pod::Elemental::PerlMunger
CPAN shell
perl -MCPAN -e shell install Pod::Elemental::PerlMunger
For more information on module installation, please visit the detailed CPAN module installation guide.