Subject: | Unknown config parameter "long_prefix_pattern" |
Date: | Tue, 27 Sep 2011 22:56:33 +0400 |
To: | bug-Getopt-Long [...] rt.cpan.org |
From: | Van de Bugger <van.de.bugger [...] gmail.com> |
Perl v5.12, Getopt::Long v2.38.
Getopt::Long::Configure( qw{ long_prefix_pattern } );
causes error message
Getopt::Long: unknown config parameter "long_prefix_pattern"
at /usr/share/perl5/Getopt/Long.pm line 1371.
There are two problems:
1. long_prefix_pattern is described in the documentation, why it is
unknown?
2. Why error reported in the Long.pm line 1371? If it is unknown
configuration parameter, it is my mistake, error should be reported in
my code, not the code of Getopt::Long.
---
Studying Getopt::Long source code I found the value for
long_prefix_pattern configuration parameter is mandatory, and missed
value causes this error.
Thus, current error message is misleading and confusing. If value for
long_prefix_pattern is really mandatory, I would like error message
clearly states it.
---
Background:
In my script I wanted to use "two-pass" command line parser:
1. "First pass" parses usual command-line options with a help from
Getopt::Long.
2. "Second pass" interprets arguments in order of appearance and
executes them as commands. However, I wanted my script recognizes
abbreviated commands, ensures commands have mandatory arguments (like
file=filename) etc. I though Getopt::Long may do this job if I configure
it: long_prefix_pattern= no_permute.
---
Thanks anyway. I use Getopt::LOng for many years, it is the first issue
I faced in this module.
Van.