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

Report information
The Basics
Id:
14852
Status:
open
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
ghenry [...] perl.me.uk
Cc:
AdminCc:

BugTracker
Severity:
Unimportant
Broken in:
0.99.2
Fixed in:
(no value)



Subject: Bypassing the menu option via $ARGV[0]?
This is also relating to http://perlmonks.org/?node_id=496268 Tanktalus and myself are discussing what happened to the menu I generated, i.e. it being bypassed by a commandline option: my $avi = $ARGV[0]; but changing that to: my $avi = shift; and it's fine. Do you think it's worth mentioning this in the docs, or is this something to do with my coding skills? Thanks, Gavin.
Date: Sat, 01 Oct 2005 11:35:42 +1000
From: Damian Conway <damian@conway.org>
To: bug-IO-Prompt@rt.cpan.org
Subject: Re: [cpan #14852] Bypassing the menu option via $ARGV[0]?
RT-Send-Cc:
Show quoted text
> This is also relating to http://perlmonks.org/?node_id=496268
Thanks for drawing it to my attention, Gavin. See my reply at: http://www.perlmonks.org/?node_id=496579 Damian
From: jaybuffington@gmail.com
This just bit me. Ouch! My script looks something like this: #!/usr/bin/perl use strict; use warnings; use IS::Creative; use IO::Prompt; foreach my $creative_id (@ARGV) { my $creative = IS::Creative->new( $creative_id ); if ( !$creative->exists() ) { warn "Creative #$creative_id doesn't exist, skipping"; } if ( prompt("Are you sure you want to delete creative #$creative_id? ", '-yt') ) { $creative->delete(); print "Creative $creative_id deleted!\n"; } } Example run: jay@webdev:~$ ./delete_creatives.pl 4141849643 Can't open 4141849643: No such file or directory at ./delete_creatives.pl line 16 jay@webdev:~$ After reading this discussion I added -t to the prompt() options, and things started working like I expected. I probably would have solved this problem this much faster (boy was I confused!) if the "Can't open %s: %s" part of the DIAGNOSTICS section added a line like this: If @ARGV contains something other than a file when prompt() is called, either use the -tty option or remove those values from @ARGV.
From: jaybuffington@gmail.com
Sorry, I pasted the corrected version of the script. The incorrect version doesn't have the -t in the prompt() options. :)


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.