Skip Menu |

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

Report information
The Basics
Id: 77054
Status: open
Priority: 0/
Queue: IO-Prompter

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

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



Subject: Options -in/-out=>*FH (and -stdio) seem broken
For IO::Prompter v0.002000, options -in=>*FH, -out=>*FH (and hence -stdio) to prompt() no longer seem to work. Eg -------------------- use IO::Prompter; my $n = prompt -num, -in=>*STDIN, 'Enter a number'; say "You entered: $n"; -------------------- results in the error: prompt(): Unacceptable value for -in (expected valid filehandle or filename) I'm happy to use -in=>\*FH etc (which work) if necessary, but -stdio will still be broken. A possible patch is just -------------------- --- Prompter.pm.orig 2012-05-08 12:09:32.679986598 +0800 +++ Prompter.pm 2012-05-08 12:05:55.030907337 +0800 @@ -88,12 +88,12 @@ # Work out where the prompts go, and where the input comes from... my $in_filehandle = $opt_ref->{-in} // _open_ARGV(); my $out_filehandle = $opt_ref->{-out} // qualify_to_ref(select); - if (!ref $in_filehandle) { + if (!ref $in_filehandle && ref(\$in_filehandle) ne "GLOB") { open my $fh, '<', $in_filehandle or _opt_err('Unacceptable', '-in', 'valid filehandle or filename'); $in_filehandle = $fh; } - if (!ref $out_filehandle) { + if (!ref $out_filehandle && ref(\$out_filehandle) ne "GLOB") { open my $fh, '>', $out_filehandle or _opt_err('Unacceptable', '-out', 'valid filehandle or filename'); $out_filehandle = $fh; -------------------- Thanks, David
Subject: Re: [rt.cpan.org #77054] Options -in/-out=>*FH (and -stdio) seem broken
Date: Tue, 8 May 2012 10:48:17 +0200
To: bug-IO-Prompter [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Thanks for the report, David. I have fixed this for the next release. Damian