Hello,

I'm trying to use the 'AppConfig::Getopt' module to parse my command-line arguments, 
assigning the passed values to a hash.  It's not working.  And I need help.

For example:

  # test.pl -pagerdest [EMAIL PROTECTED]

Should result in:

  %pagerdest = {
     'karl' => '[EMAIL PROTECTED]'
  };

but, instead, I end up with:

  %pagerdest = {
     '[EMAIL PROTECTED]' => undef
  };


It looks like there's a problem with how AppConfig is linking the values back from 
Getopt::Long.  Getopt::Long appears to be stripping out the "key=" portion of the 
hash's argument -- if the linkage reference is 'CODE' rather than 'HASH'.

The following code snippet provides an example of how AppConfig is receiving changes 
from Getopt::Long; and the example below shows the loss of the hash key from the 
arguments.

Any idea how to fix the problem?  Or where else to search for an answer?

Thanks in advance.

Regards,
Karl K.


#####  code example #####
use Getopt::Long;

$linkage = sub { print "@_\n"; };

Getopt::Long::Configure('debug');
GetOptions("pagerdest=s%" => $linkage);
##### end of code example ###### 


Example debug output -- 

# ./test.pl -pagerdest [EMAIL PROTECTED]

GetOpt::Long 2.19 called from package "main".
  GetOptionsAl $Revision: 2.20 $
  ARGV: (-pagerdest [EMAIL PROTECTED])
  autoabbrev=1,bundling=0,getopt_compat=1,order=1,
  ignorecase=1,passthrough=0,genprefix="(--|-|\+)".
=> link "pagerdest" to CODE(0xcd370)
=> $opctl{"pagerdest"} = "=s%"
=> option "-pagerdest"
=> find "-pagerdest", prefix="(--|-|\+)"
=> split "-"+"pagerdest"     
=> 1 hits (pagerdest) with "pagerdest" out of 1
=> found "=s%" for pagerdest 
=> ref($L{pagerdest}) -> CODE 
=> &L{pagerdest}("pagerdest", "[EMAIL PROTECTED]")
pagerdest [EMAIL PROTECTED]

Reply via email to