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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |