parv has asked for the wisdom of the Perl Monks concerning the following question:

I was trying to set prefix option for Getopt::Long but that produces the error message as if that option is unknown or I am doing something wrong (what exactly?) ...

use v5.32; use warnings; use Getopt::Long; printf qq[Version: perl %s, Getopt::Long %s\n], $^V, $Getopt::Long::VERSION; #use Getopt::Long qw[:config debug prefix - ]; # # Only difference is time, compile or run, of error ... # # Getopt::Long: unknown or erroneous config parameter "prefix" # Getopt::Long::Configure( q[debug], q[prefix], q[-] ); __END__ Version: perl v5.36.3, Getopt::Long 2.52 Getopt::Long: unknown or erroneous config parameter "prefix"

... So how do I set the prefix string?

Got the same error with long_prefix_pattern configuration option. A search brings up issues with user options; did not see anything relevant to module configuration.

Linked to here on Mastodon.

Replies are listed 'Best First'.
Solved- Re: Getopt::Long- Trying to specify "prefix" configuration option produces error
by parv (Parson) on Feb 25, 2024 at 02:30 UTC

    Just hilarious😂!

    Well got impatient & could not wait for a clue, so looked in /usr/local/lib/perl5/5.36/Getopt/Long.pm, there saw "prefix="(💡) ...

    1335 # Getopt::Long Configuration. 1336 sub Configure (@) { ... 1423 elsif ( $try =~ /^prefix=(.+)$/ && $action ) { 1424 $genprefix = $1; 1425 # Turn into regexp. Needs to be parenthesized! 1426 $genprefix = "(" . quotemeta($genprefix) . ")"; ...

    ... So I had failed to use = as a option-value joiner that the doc says nothing about (all it has about configuration: This subroutine takes a list of quoted strings, each specifying a configuration option to be enabled). Obviously🙄

        Well got impatient & ..

      .. had a look and solved your own problem, proving once again the value of open source software. Got a problem? Documentation unclear? Have a look in the source code.

      Great job!

      Alex / talexb / Toronto

      Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.