Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

how POD will look on CPAN

by spx2 (Deacon)
on Oct 01, 2009 at 08:49 UTC ( [id://798560]=perlquestion: print w/replies, xml ) Need Help??

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

I'm writing some POD documentation for a module which will eventually be uploaded on CPAN. It will be my first module so I don't know much about this.

I don't want to do a half-assed job on it so I want to test how it will look. Because of this I've tried getting the stylesheets that CPAN has in order to replicate how it will look after uploaded (also, if it the upload would be instantaneous, I could try stuff that way, but since it takes about 1 day for it to be processed I'd prefer to test locally first).

I tried to put the following POD so that I can have the same stylesheets but it broke my existing POD.. and it didn't work.

=begin html <link rel="stylesheet" href="http://st.pimg.net/tucs/style.css" typ +e="text/css" /> <link rel="stylesheet" href="http://st.pimg.net/tucs/print.css" typ +e="text/css" media="print" /> =end html

I am looking forward to your thoughts on how I can do this .

Thanks for taking the time to read this.

Best regards,

Stefan

Replies are listed 'Best First'.
Re: how POD will look on CPAN
by moritz (Cardinal) on Oct 01, 2009 at 09:06 UTC
    AnonMonk is right - layout is not your business, you should not care. If you optimize for how it will look on search.cpan.org, chances are that the layout will look horribly on kobesearch or other CPAN frontends.

    Instead you should just make a homepage for your module somewhere (where you have complete control over the layout) and provide a link for that in your POD.

    Perl 6 - links to (nearly) everything that is Perl 6.
Re: how POD will look on CPAN
by Bloodnok (Vicar) on Oct 01, 2009 at 09:04 UTC
    As AM has hinted, the idea of POD is that it is essentially an implementation neutral documentation markup language - I use pod2html, browsing the generated HTML, whenever I feel the urge to have a look at how it might look...

    A user level that continues to overstate my experience :-))
      I only check the original intended target: manual pages. If it looks good in 'pod2man Foo.pm | nroff -man | less' on a 80 character window, I'm ready to ship it.
        I'd do that too, but pod2html is far less prone to typing error :-D ... and of course, pod2html has the distinct advantage of platform neutrality.

        A user level that continues to overstate my experience :-))
Re: how POD will look on CPAN
by ELISHEVA (Prior) on Oct 01, 2009 at 11:16 UTC

    I beg to differ about "not caring". Using the exact style sheet as CPAN probably isn't important, but making sure you have an idea of how the pod is being parsed is important.

    It isn't so easy to read the text version of the pod file and be certain that you have all of your pod tags in the right place and properly formatted. Looking at an HTML rendering provides important and easy to assess visual feedback on your pod tagging. I make mistakes all the time, especially when I'm nesting tags, using unfamiliar pod syntax, or linking to external material. The documentation of pod syntax also isn't always 100% and it is necessary to experiment a bit before one has the right syntax. Broken links are another matter that is hard to assess merely by reading the pod file.

    You can get a rough idea of how the HTML will look by using the pod2html program. At the minimum it will help you identify syntax errors, misplaced tags, and broken links.

    Best, beth

      I tend to only use pod2html if I'm interested in how the end result will/might look - to use it to parse and validate the POD is, IMO, overkill since you need to run the program and then (re-)load the generated page in your browser.

      Whereas, whilst developing/writing the pod, I simply run perldoc over the module/script/pod file under development - much easier and quicker.

      A user level that continues to overstate my experience :-))
Re: how POD will look on CPAN
by toolic (Bishop) on Oct 01, 2009 at 12:40 UTC
Re: how POD will look on CPAN
by jmcnamara (Monsignor) on Oct 01, 2009 at 21:35 UTC

    Here is a small filter program based on Pod::Simple::HTML (like search.cpan) that also uses their css and will give you a good idea of how it will look (and also report any Pod errors):
    #!/usr/bin/perl -w use strict; use Pod::Simple::HTML; my $parser = Pod::Simple::HTML->new(); if (defined $ARGV[0]) { open IN, $ARGV[0] or die "Couldn't open $ARGV[0]: $!\n"; } else { *IN = *STDIN; } if (defined $ARGV[1]) { open OUT, ">$ARGV[1]" or die "Couldn't open $ARGV[1]: $!\n"; } else { *OUT = *STDOUT; } $parser->index(1); $parser->html_css('http://search.cpan.org/s/style.css'); $parser->output_fh(*OUT); $parser->parse_file(*IN); __END__
    You can run it as follows:
    perl pod2cpanhtml.pl Module.pm > module.html

    Update: This utility is now available on CPAN as pod2cpanhtml which is installed as part of App::Pod2CpanHtml.

    --
    John.

      thanks , this is exactly what I needed and I'm using it now :)
        actually now that I think of it, I could've just injected the css ... it's funny
Re: how POD will look on CPAN
by Anonymous Monk on Oct 01, 2009 at 08:57 UTC
    You aren't supposed to care
      I do care, that's why I posted.
        Upload straight html?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-20 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found