Pod 2 html formatter that will run online?

L

Lars Eighner

How about pod2html? (minimally tested)
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $cgi=CGI->new;
print $cgi->header;
# if your perl sets -T when run under a webserver
$ENV{PATH}='';
print `/usr/bin/pod2html /usr/lib/perl5/5.8.4/Pod/Text.pm`;

In addition to the above, pod2html seems to require a scratch file,
so you have to change to a world readable and writeable directory, as it
runs as nobody.

As I am working in PHP, this works where tmp is a world writeable, world
readable directory below the current one.

<?php

$old = getenv('PATH');
echo '<p>',$old,' oldpath</p>';
putenv("PATH=''");
$ocwd = getcwd();
echo '<p>',$ocwd,' old current working directory</p>',
chdir('tmp');
$foo =
`/usr/local/bin/pod2html /usr/local/lib/perl5/5.8.8/pod/perldoc.pod`;
$foo = htmlspecialchars($foo);
putenv('PATH='.$old);
$foo = htmlspecialchars($foo);
echo '<p>',$foo,'<p>';
echo '<p>',getenv('PATH'),' restored path</p>';
chdir($ocwd);
echo '<p>',getcwd(),' restored current working directory</p>';

?>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top