Michael Alan Dorman <[EMAIL PROTECTED]> writes:

> A Debian user noticed that lwp-rget prints the help output twice with
> the '--help' argument.
> 
> The problem is that when usage is invoked as the callback for the
> 'help' option, it outputs everything, and then GetOptions traps the
> 'die', makes GetOptions return a failure indicator, and the '|| usage'
> after GetOptions runs.
> 
> The fix is simple, I think---change the callback for the 'help' option
> to be a simple 'die', and the error that is returned from GetOptions
> will cause 'usage' to fire.

Thanks for letting me know.  The suggested fix cause this ugliness to
appear:

  $ perl bin/lwp-rget --help
  Died at bin/lwp-rget line 163.
  Usage: lwp-rget [options] <URL>
  Allowed options are:
    --auth=USER:PASS  Set authentication credentials for web site
    --depth=N         Maximum depth to traverse (default is 5)
    --hier            Download into hierarchy (not all files into cwd)
  ...

so I applied this simple patch instead:

Index: lwp-rget
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/bin/lwp-rget,v
retrieving revision 2.0
diff -u -p -u -r2.0 lwp-rget
--- lwp-rget    3 Jan 2002 01:42:31 -0000       2.0
+++ lwp-rget    24 Jan 2003 05:53:30 -0000
@@ -573,7 +573,7 @@ sub save
 
 sub usage
 {
-    die <<"";
+    print <<""; exit 1;
 Usage: $progname [options] <URL>
 Allowed options are:
   --auth=USER:PASS  Set authentication credentials for web site

Regards,
Gisle

Reply via email to