I'm seeking any suggestions on how one may gain access to embedded POD
documentation from a compiled Perl script?
Environment:
Target OS: Windows (XP primarily)
(All tools are currently designed for Windows XP use only--although
some may later be modified for use on some UNIX-based systems as well;
e.g., Linux, SunOS, HP-UX)
Build Host OS: Windows XP
Perl Version: ActiveState v5.8.7
Compiler: ActiveState PerlApp v6.0.2
Problem Description:
All our tools need to be compiled for corporate world-wide access and
we prefer not to have to supply a separate POD file with every tool on
our servers.
Solution Desired:
We want to be able to deploy a single executable image file (that
contains bound POD documentation) for each Perl/Tk tool so that any
user may view the tool's POD documentation via its command line options
or its GUI help pop-up window.
Partial Solution Found:
I have managed to get command line access to a tool's embedded POD
documentation using pod2usage and binding the POD source file to the
compiled executable. However, I have not been able to find a way to
access the same bound POD documentation from within the tool's (Tk)
GUI.
My latest attempt uses 'parse_from_file' within the GUI's help method.
However, it only works as long as the script containing the POD
documentation accompanies the executable. Using pod2usage, on the
other hand, dumps the POD info to the console window rather than the
GUI pop-up window created by the Help toolbar button. Probably
pod2usage is the way to go (since it already works with the embedded
bound file), but I have not found a way to redirect its output to the
GUI pop-up window.
The following code snippet works for the command line options (where
$POD is the file name of the bound POD source file):
pod2usage (-input => $POD, -exitstatus => 0, -verbose => 0) if
$options{help};
The GUI help usage method, however, only works if the actual Perl
source file accompanies the executable (i.e., parse_from_file
apparently can't read/find the embedded bound file):
use Pod::PlainText;
my $parser = Pod::PlainText->new ();
# Write POD info to temp file.
$parser->parse_from_file ("$main::POD", "$tmpFile");
# Output POD info to pop-up window.
open (DATA, "<$tmpFile") or die "Can't open \"$tmpFile\" for
writing.\n";
while (<DATA>)
{
$text->insert ('end', $_);
$text->see ('end');
$text->update ();
}
close (DATA);
# Start login window event handler.
MainLoop ();
Actually, I'd prefer to not have to write the POD data to disk
($tmpFile) at all, but I haven't been successful at reading back the
data written to memory (e.g., using parse_from_filehandle) either.
Any suggestions for a better approach would be greatly appreciated.
Thanks!
Craig