Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

unhappy with Pod::Html

by dada (Chaplain)
on May 14, 2003 at 13:06 UTC ( #258064=perlquestion: print w/replies, xml ) Need Help??

dada has asked for the wisdom of the Perl Monks concerning the following question:

hello all,

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:

my $html_snippet = pod2html($pod_snippet);
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.

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:

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;
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.

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
    Not a direct answer to your question of whether Pod::Html should be kicked out, but have you tried Mr. Burke's Pod::Simple? Here's what your code would look like with P::S
    use Pod::Simple::HTML; my $p = Pod::Simple::HTML->new; $p->output_string(\my $html); ## assuming $pod_snippet already exists $p->parse_string_document($pod_snippet);
    Apparently it's all the rage these days with them kids, and also might make you forget all about Pod::Html ;)
    HTH

    _________
    broquaint

      looks fine, thank you. as I was looking for an ASAP-type solution, I just made a little tour on http://search.cpan.org to see what was there, without paying much attention.

      very much probably, I overlooked Pod::Simple::HTML for its total lack of documentation :-)

      cheers,
      Aldo

      King of Laziness, Wizard of Impatience, Lord of Hubris

      I'd ++ this if I could vote.
      Ah, If I'd only decided to search PM a month ago, ...before I ripped my hair out trying to get pod2html->cgi working.

      haruspex: soothsayer to the stars

      "sooth!!!" -me
Re: unhappy with Pod::Html
by PodMaster (Abbot) on May 14, 2003 at 13:52 UTC
    I disagree.
    Pod::Html is not on CPAN, it's a part of CORE.
    Pod::Html has been like this for a long time (very long time).

    You're not the first to complain, but most others interested in converting pod to html found other means:

    • Pod::POM -- very nice, just a few bugs here and there {I think I fixed the big ones}
    • Pod::Simple -- needs more pod ;P (it's a beta release)
    • Marek::Pod::HTML -- aims to replace Pod::Html (works rather well, try this one -- i'm thinking of making Pod::Master work more with it).

    Extending Pod::Html would require a rewrite of Pod::Html.

    it required the installation of 4 additional modules
    And here I thought you were grown up ;)
    and if it doesn't want to do it, let's kick it out from CPAN! ;-)
    No. (it? Pod::Html is a module). You're very much welcomed and encouraged to improve it and submit a patch along with tests to the perl 5 porters.


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      thanks PodMaster, I quote you in random order:
      I disagree ... No
      yup. I was obviously joking, I don't really want to kick anything out from anywhere :-)
      You're not the first to complain, but most others interested in converting pod to html found other means
      what I found was just the result of a quick search. it probably has something to do with the visibility of certain modules on search.cpan.org. or with my inability to use search.cpan.org, your choice :-)
      Pod::Html has been like this for a long time (very long time).
      ...
      Extending Pod::Html would require a rewrite of Pod::Html.
      and this was my point. I am unhappy with the current implementation of Pod::Html, because I see it as "the" standard way of converting POD to HTML. and for it to be something that can be called a module (eg. something that other programs than pod2html can use), it certainly needs a rewrite.
      You're very much welcomed and encouraged to improve it and submit a patch along with tests to the perl 5 porters
      ouch. this is the answer I feared most :-) frankly, my TODO list is consistently out of heap space, so I throw the idea out: who wants to take over Pod::Html and rewrite it?

      it? Pod::Html is a module
      o my poor english :-) should I've used "he" instead?

      cheers,
      Aldo

      King of Laziness, Wizard of Impatience, Lord of Hubris

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://258064]
Approved by cciulla
Front-paged by bronto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-01-17 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (51 votes). Check out past polls.

    Notices?