wind has asked for the wisdom of the Perl Monks concerning the following question:
Ultimately, I'm attempting to create a couple of simple scripts in order to practice with the functionality of the Expect module. My first step was to create a script that would prompt for dummy STDIN interaction and quit with an "exit" command. In order to also try out the suggestion from "Perl Best Practices" Chapter 10 for using IO::Prompt, I came up with the following script:Cannot write to terminal: No such file or directory at scratch.pl line + 13
The above code works fine on linux, but fails with the above error on my windows box. The DIAGNOSTICS section of the pod states this concerning the error:use IO::Prompt; use strict; print <<'END_INTRO'; Mary had a little lamb Then the lamb ate Mary and it was little no more. END_INTRO my $choice = ''; while ($choice ne 'exit') { $choice = prompt "Prompt: ", -require => {"Prompt (requires a single word, exit to quit): " + => qr/^\w+$/}; print "You typed '$choice'\n"; }
Cannot write to terminal: %sI have trouble imagining that this module was not intended for use with ActivePerl. Especially if it was suggested in the Best Practices Book. However, if this is the case, is there an alternative module that y'all would suggest?
Cannot read from terminal: %s
prompt() attempted to access the terminal but couldn't. This may mean your environment has no /dev/tty available, in which case there isn't much you can do with this module. Sorry.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IO::Prompt - Cannot write to terminal
by syphilis (Archbishop) on Jul 21, 2007 at 01:30 UTC | |
by wind (Priest) on Jul 21, 2007 at 01:48 UTC | |
by BrowserUk (Patriarch) on Jul 21, 2007 at 02:15 UTC | |
by wind (Priest) on Jul 21, 2007 at 02:28 UTC | |
|
Re: IO::Prompt - Cannot write to terminal
by BrowserUk (Patriarch) on Jul 21, 2007 at 02:10 UTC |