| Apache2-Pod documentation | Contained in the Apache2-Pod distribution. |
Apache2::Pod::Text - mod_perl handler to convert Pod to plain text
Version 0.27
A simple mod_perl handler to easily convert Pod to Text.
You can replace Apache2::Pod::HTML with Apache2::Pod::Text as your
PerlHandler in your apache configuration if you wish to use the
text rendering of your pod documentation instead of HTML.
See Apache2::Pod::HTML for configuration details.
Theron Lewis <theron at theronlewis dot com>
Adapteded from Andy Lester's <andy at petdance dot com> Apache::Pod
package which was adapted from
Apache2::Perldoc by Rich Bowen <rbowen@ApacheAdmin.com>
Thanks also to Pete Krawczyk, Kjetil Skotheim, Kate Yoak and Chris Eade for contributions.
This package is licensed under the same terms as Perl itself.
| Apache2-Pod documentation | Contained in the Apache2-Pod distribution. |
package Apache2::Pod::Text;
use strict; use vars qw( $VERSION ); $VERSION = '0.27';
use Apache2::Pod; use Apache2::Const -compile => qw( OK ); use Pod::Simple::Text; sub handler { my $r = shift; my $str; my $file = Apache2::Pod::getpodfile( $r ); my $fun = undef; my $parser = Pod::Simple::Text->new; $parser->complain_stderr(1); $parser->output_string( \$str ); if ( $file ) { if ( $file =~ /^-f<([^>]*)>::(.*)$/ ) { $fun = $1; $file = $2; } if ( $fun ) { my $document = Apache2::Pod::getpodfuncdoc( $file, $fun ); $parser->parse_string_document( $document ); } else { $parser->parse_file( $file ); } } else { my $modstr = Apache2::Pod::resolve_modname( $r ) || $r->filename || ''; my $document = sprintf "=item %1\$s\n\nNo documentation found for \"%1\$s\".\n", $modstr; $parser->parse_string_document( $document ); } $r->content_type('text/plain'); $r->print( $str ); return Apache2::Const::OK; }
1;