|Syntactic Confectionery Delight|
Getopt::Long mysteryby Llew_Llaw_Gyffes (Beadle)
|on Aug 17, 2005 at 22:03 UTC||Need Help??|
Llew_Llaw_Gyffes has asked for the
wisdom of the Perl Monks concerning the following question:
I have a Perl script which begins as follows:
In this script, and ONLY this script, Getopt::Long fails. In every other script I have, it's working perfectly. Invoking the above script with a sample command line yields:
I'm baffled. I've rewritten the entire top of the file by hand in case somehow the file has become corrupted with some invisible character. I can see nothing wrong with it, but I can't make it work, and no other Getopt::Long-using script on my system breaks the same way. If I remove the call to Getopt::Long::Configure, the GetOptions call recognizes options again, but of course option bundling no longer works. If I write a new script from scratch comprising nothing but a call to Getopt::Long and the necessary declarations, it fails in the same way; yet every other existing script using Getopt::Long and Getopt::Long::Configure("bundling") continues to work.
Can anyone some up with any theory, however wild, to explain what's going on, or point out some error in the code that I've somehow missed?Update:
It was not clear from the example above that ALL options are unrecognized, not just -t. To clarify, if I comment out the bundling configuration, I can do the following:
Now, if I re-enable the Configure call and issue the exact same command:
In subsequent messing with this, I've discovered that I can make it recognize the command line options again by explicitly specifying the appreviations I want to be accepted. It is possible I have misunderstood the documentation on the module. The documentation states:
Now, the interaction between bundling and ignore-case is documented, but NOWHERE IS IT SPECIFICALLY STATED that setting any particular configuration option (bundling, for example) disables the automatic abbreviation. It appears, however, with further examination, that this is what's happening: if bundling is enabled, automatic abbreviation of command-line options is silently disabled. What's more, there appears to be no mechanism for re-enabling it.
Can anyone confirm that this behavior is in fact intentional? If so, it really should be documented.