Skip Menu |

This queue is for tickets about the IO-Prompt CPAN distribution.

Report information
The Basics
Id: 52371
Status: open
Priority: 0/
Queue: IO-Prompt

People
Owner: Nobody in particular
Requestors: bruce [...] fortressofgeekdom.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Reading input via *ARGV not documented
Date: Wed, 02 Dec 2009 11:53:15 -0700
To: bug-io-prompt [...] rt.cpan.org
From: Bruce Armstrong <bruce [...] fortressofgeekdom.org>
I was writing a small script to operate on a file passed via the command line and found that prompt was not prompting. I first thought this was a bug, but then carefully went through all the documentation and found my error in the DIAGNOSTICS section, so it is at least known behavior. This behavior is not documented anywhere else. I can see how it may be useful, but it seems more likely to be a pitfall. Please at least add a note in either the synopsis or description to explain that IO::Prompt will look at the arguments to the script and act on them. For now, I'm going to have to clear out @ARGV before calling prompt to avoid this since the whole point of using prompt (in this script) was to verify the user didn't mistype and was ok with what was about to happen.
Subject: Re: [rt.cpan.org #52371] Reading input via *ARGV not documented
Date: Thu, 3 Dec 2009 06:44:30 +1100
To: bug-IO-Prompt [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Hi Bruce, Thanks for the report and sorry for the hassles you had. I've passed on the ownership of IO::Prompt and make sure your doc suggestion is passed on too. Show quoted text
> For now, I'm going to have to clear out @ARGV before calling prompt to > avoid this
You don't have to empty @ARGV. You can just do something like this: my $response = do { local *ARGV; prompt "Are you ok with what's about to happen?" }; Damian
FWIW, this is still a problem: [dmuey@hal9000 ~]$ head -n 2 tmp/test.perl use Data::Dumper; my %action; [dmuey@hal9000 ~]$ perl -MIO::Prompt -Mstrict -we 'print IO::Prompt->VERSION() . "\n";my $r=prompt("howdy: ");print "-$r-\n";' 0.997001 howdy: dooty -dooty- [dmuey@hal9000 ~]$ perl -MIO::Prompt -Mstrict -we 'print IO::Prompt->VERSION() . "\n";my $r=prompt("howdy: ");print "-$r-\n";' tmp/test.perl 0.997001 -use Data::Dumper;- [dmuey@hal9000 ~]$