[Pdx-pm] io prompt question

Michael R. Wolf MichaelRWolf at att.net
Fri Dec 19 15:51:16 PST 2008

On Dec 18, 2008, at 5:17 PM, Eric Wilhelm wrote:

> Aside:  did you mean to reply to the list?
> # from Thomas Keller
> # on Thursday 18 December 2008 16:36:
>> I mixed up where the warning was coming from. It was actually from a
>> poor approach to assignment:
>> my $parser_options = prompt("Accept parser default values: ", -yn)

Off hand, I'd suggest quoting '-yn', else it looks like the unary  
negation of the tr/// command that's using the 'y' (for hysterical  
reasons) alias of the transliteration, and only supplying one (of 3)  
custom delimiters.  In effect, your code is an incomplete start toward  
this code
   -($_ =~ ynXXXnYYYn)
which may look more familiar as

You've supplied 'n' instead of '/', and therefore have an incomplete  

Folks get used to having -yn as a string in the following cases, but  
it's not the dash that does the magic, it's the fat comma.

my $answers = (
   -yn => 'yes or no',
  -n   => 'no',
  -y  =>  'yes',

Since the only documented uses of the -flag notation are immediately  
followed by the fat comma, it could be misleading.

If this suggestion fixes your code, could you submit your code as a  
bug fix request at CPAN RT?  I guess it's not a "but", but could use a  
better example in the docs to hilight the problem you ran into.

Michael R. Wolf
     All mammals learn by playing!
         MichaelRWolf at att.net

More information about the Pdx-pm-list mailing list