Pod::Event::Parser - A simple event based POD parser
use v6-alpha; use Pod::Event::Parser; parse("path/to/file.pod", %event_handlers);
This is a straightforward event based POD parser, it is modeled after XML SAX parsers and is currently in the early stages of development.
Basic parsing functionality is fairly solid right now. The t/complex.t test actually roundtrip parses this document successfully. However, more complex POD documents may not do as well. Error reporting is still pretty minimal and the parser is not very forgiving about whitespace in some situations.
The main parse function currently takes a $filename and a Hash of %events which it uses to process each line of the file.
parse
$filename
%events
This event is fired when a '=pod' directive is reached.
This event is fired when a '=cut' directive is reached.
For each POD element, an event is fired, the first argument to all these events is the $event_type (header, list, item, etc.).
$event_type
This event is fired once the '=head(n)' directive is reached. This does not include the text of the header, that will be processed as a interpolated string (to allow for any modifiers).
This event is fired after the '=head(n)' directive and it's accompanying text has been parsed.
This event is fired when a '=begin' directive is reached.
This event is fired when a '=end' directive (which is preceeded by an '=begin' directive) is reached.
This event is fired when a '=for' directive is reached.
This event is fired when a '=end' directive (which is preceeded by an '=for' directive) is reached.
This event is fired when an '=over' directive is reached.
This event is fired when a '=back' directive is reached.
This event is fired when an '=item' directive is reached, the next event fired will be any text which follows the item.
This event is fired once the last '=item' directive, followed by any text on the same line.
This event is fired once a verbatim section is found.
This event closes a verbatim section.
This event is begun when any block of characters is interpolated for modifiers.
This event is fired when interpolation is complete.
This event is fired when a modifier is encountered.
This event closes a modifier.
This event handles the entire verbatim string.
This event processes raw strings.
This event handles newlines in the text, it is a specialization of the 'string' event.
stevan little, <stevan@iinteractive.com>
Copyright (c) 2005. Stevan Little. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Perl6::Pugs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl6::Pugs
CPAN shell
perl -MCPAN -e shell install Perl6::Pugs
For more information on module installation, please visit the detailed CPAN module installation guide.