On Wed, Mar 10, 2004 at 08:38:57PM -0800, Alan Stewart <[EMAIL PROTECTED]> wrote:
> On 10 Mar 2004 at 11:25, David Good wrote:
> 
> > It takes about 10 seconds for the par-bundled program to run with the
> > --help option (and do nothing).  It finishes in less than a second if
> > I remove the --help option.
> By default, Pod::Usage tries to open the executing file and read it. That means it 
> is 
> probably trying to open and read the binary zipped contents of "test", and spending 
> a 
> lot of time trying to find pod lines in there...

I figured as much, but wasn't sure how it all worked.

> > 
> > Any suggestions (even if it's just "Don't use Pod::Usage")?
> > 
> Patient: It hurts when I do this.
> Doctor: Don't do that !

Exactly what I was thinking :-)

> Seriously, if you don't mind having your all your usage pod after a __DATA__ 
> statement, 
> the following works for straight perl or PAR executables 'cause it reads from inside 
> the running perl:


Perfect!  I used to have it after an __END__ statement, so it would be really
easy to make the change. Thanks!


> 
> ################################
> #!perl -w
> use strict;
> 
> use warnings;
> use Getopt::Long;
> use Pod::Usage;
> 
> my  $help;
> GetOptions(
>         "help" => \$help,
> ) or pod2usage(-exitval => 2, -input => \*DATA);
> pod2usage(-exitval => 1, -input => \*DATA) if $help;
> 
> die "Made it past the options...\n";
> 
> __DATA__
> =head1 NAME
> 
> test - Test Pod::Usage with PAR
> 
> =head1 SYNOPSIS
> 
> test [options]
> 
> =head1 OPTIONS
> 
> =over 8
> 
> =item B<--help>
> 
> Print a brief help message and exit.
> 
> =back
> ################################
> 
> Alan Stewart

Reply via email to