I want to document my program inside the source file using Pod::Text.

This works fine using perl program.pl, but fails if I generate an executable file using pp.

Her is a a small script that show what happens.

#! /usr/bin/perl use warnings; use strict; use Pod::Text; use File::Basename; userManual(); sub userManual { # show user manual my $pod = basename $0; # the pod text is in the perl fi +lew my $tmp = getTMP(); # look for a temp file my $parser = Pod::Text->new (); # convert pod to text $parser->parse_from_file ($pod, $tmp); # do the convertion die "Can't open $tmp ($!)\n" unless (open (TXT, $tmp)); # OOPS while (<TXT>) { # display the text file print; } close TXT; # close the text file unlink $tmp; # and delete it } sub getTMP { use POSIX qw(tmpnam); my $name; do { $name = tmpnam() } until (! -e $name); # try until we get +one that didn't already exist return $name; } =pod =head1 PROGRAM NAME B<program> - This is the program =head1 DESCRIPTION The program B<program> bla bla bla bla bla bla bla bla bla bla bla bla + bla bla bla bla bla bla bla bla bla bla bla bla. =head1 AUTHOR memo garcia <mgarcia@cistrans.cl>. March, 2010 =cut

What Pod::Text is using as input file is the executable and not the perl code.

One solution is to separate the pod source in program.pod and use this as the input for Pod::Text, but I want to distribute one single file to the end user.

Any idea??

memo


In reply to using Pod::Text and pp by memo.garciasir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.