dada has asked for the wisdom of the Perl Monks concerning the following question:
a few days ago I was doing some data munging on the perlfaq manpages (basically, splitting each page in single faqs and put them in a DB table) and after a while I realized I had the need to convert a snippet of POD (a single faq) to HTML.
I promptly typed use Pod::Html; but suddenly I felt something was wrong. what I wanted was something like:
but Pod::Html seems to be nothing more than a backend for the (totally fine) pod2html script. Thus, it only accepts input from a file (or STDIN) and writes to a file (or STDOUT). gack.my $html_snippet = pod2html($pod_snippet);
for my application, which is a CGI script, I was absolutely reluctant to spool on the filesystem, and while I can think about redirecting STDOUT to a variable, setting up a fake STDIN for pod2html to read from a variable looks, at the very least, unnecessarily complicated.
after a bit of homework, I found a solution (workaround?) to my problem:
it works ($html_snippet will contain the pod2htmlized $pod_snippet), but it required the installation of 4 additional modules (let alone syntactic cruft and efficiency concerns), just to make something that Pod::Html could, and should, very easily handle.use IO::Scalar; use Pod::Tree::HTML; $html_snippet = ""; $html_snippet_handle = IO::Scalar->new(\$html_snippet); $pod2html = Pod::Tree::HTML->new(\$pod_snippet, $html_snippet_handle); $pod2html->translate;
so the question is: am I the only one to think that Pod::Html should do far, far much more than it does now? and if it doesn't want to do it, let's kick it out from CPAN! ;-)
cheers,
Aldo
King of Laziness, Wizard of Impatience, Lord of Hubris
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: unhappy with Pod::Html
by broquaint (Abbot) on May 14, 2003 at 13:37 UTC | |
by dada (Chaplain) on May 14, 2003 at 13:44 UTC | |
by haruspex (Chaplain) on Jan 12, 2005 at 18:52 UTC | |
Re: unhappy with Pod::Html
by PodMaster (Abbot) on May 14, 2003 at 13:52 UTC | |
by dada (Chaplain) on May 14, 2003 at 14:18 UTC | |
by itub (Priest) on Jan 12, 2005 at 19:03 UTC |