≡ Menu

CGI To Display Module Documentation

Here’s a CGI to display a module’s POD. The module has to be in the $INC. This is great for providing documentation to internal modules.

# save this as showdoc.cgi
use strict;

use Pod::Html;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

# Send out the header
print "Content-type: text/html", "nn";

my $q = new CGI;

my $module = $q->param('module');
require $module;

$| = 1;

chdir ("/tmp");

my $fullpath = $INC{$module}
    or die "$module not found";

pod2html("--infile=$fullpath", "--flush");

# Clean up the junk left by pod2html

To use this, say you want to view POD for Data::Dumper:

{ 0 comments… add one }

Leave a Comment

Next post:

Previous post: