in reply to introspection, or running pod2html on itself


You could use the core Pod::Html module directly just as pod2html does. Something like this:
#!/usr/bin/perl -w use strict; use Pod::Html; # Set the Pod::Html options such as --outfile my @html_options = ('--title=My Test'); # Some getopt code here for program options. # ... pod2html __FILE__, @html_options; __END__ =head1 TEST Some pod here. =cut

See also Pod::Usage for a text, rather than Html, way of displaying the embedded documentation.

--
John.

Replies are listed 'Best First'.
Re^2: introspection, or running pod2html on itself
by punkish (Priest) on Sep 15, 2005 at 16:15 UTC
    > You could use the core Pod::Html module directly

    Works beautifully. Many thanks.

    --

    when small people start casting long shadows, it is time to go to bed
      I spoke too soon. While Pod::Html does work very well, everything fails against a packed .exe created with pp. Seems like the package stuffs the script inside a folder within the .exe. So, if my script is myscript.pl, and I do the following
      pp -o myscript.exe myscript.pl

      myscript.pl gets stuffed as script/myscript.pl within the confines of myscript.exe. Hence, pod2html is unable to create anything against myscript.exe (because the pod is hidden inside the script).

      That is very disappointing. I could take other monks' advice and use the __DATA__ block to store my html doc and then spit it out as needed, however, I have already got everything mapped out and typed up in pod. What a chore to extract it and redo as html.

      unless... any suggestions (asks hopefully).

      By the way, how do I find out the full path of the current script? __FILE__ or $0 give only the filename (actually, __FILE__ against the above exe gives script/myscript.pl)

      --

      when small people start casting long shadows, it is time to go to bed
        Try this, save as ppselfdoc.PL, and make sure not to invoke pp with -f PodStrip :)
        #!/usr/bin/perl -- use strict; use warnings; use Pod::Html; use PAR; if (@ARGV){ print "$_\n" for PAR::read_file( q!script/ppselfdoc.PL!); } else { $ENV{PAR_0} ||= File::Spec->rel2abs(__FILE__); warn "RUNNING pod2html $ENV{PAR_0}\n"; my @html_options = ('--title=My Test'); pod2html $ENV{PAR_0}, @html_options; } exit; =head1 NAME NAME - ppselfdoc.PL =head1 SYNOPSIS print html ppselfdoc.PL print sourcecode ppselfdoc.PL 1 =cut