Pod::Knit::Plugin - base class for Pod::Knit transforming modules
version 0.0.1
use Pod::Knit::Document; use Pod::Knit::Plugin; my $doc = Pod::Knit::Document->new( file => 'Foo.pm' ); my $new_doc = Pod::Knit::Plugin->new()->munge($doc);
Pod::Knit::Plugin is the base class for the transforming modules of the Pod::Knit system.
Pod::Knit::Plugin
A plugin should override the munge method, and may implement a setup_podparser method that is invoked when the podparser of a Pod::Knit::Document is created. For example, if a plugin is to introduce two new tags, method and signature, it should have
munge
setup_podparser
podparser
Pod::Knit::Document
method
signature
sub setup_podparser ( $self, $parser ) { $parser->accept_directive_as_processed( qw/ method signature /); $parser->commands->{method} = { alias => 'head3' }; $parser->commands->{signature} = { alias => 'verbatim' }; }
Because munging XML with regular expressions and the like is no fun, you most probably want your plugins to consume either one of the Pod::Knit::DOM::WebQuery or Pod::Knit::DOM::Mojo roles, which augment the doc passed to the plugin with yummilicious DOM manipulating methods.
Orchestrating Pod::Knit object. Optional.
Hashref of variables typically passed by the knit object.
knit
$new_doc = $self->munge( $doc )
Takes in a Pod::Knit::Document, and returns a new one.
For the base Pod::Knit::Plugin class, the method is a pass-through that returns the exact same document.
Yanick Champoux <yanick@cpan.org>
This software is copyright (c) 2018 by Yanick Champoux.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Full text of the license can be found in the LICENSE file included in this distribution.
To install Pod::Knit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pod::Knit
CPAN shell
perl -MCPAN -e shell install Pod::Knit
For more information on module installation, please visit the detailed CPAN module installation guide.