Dearest Monks,

The IO::Prompt module is currently failing on my Win2000 ActivePerl 5.8.8 system with the following error:
Cannot write to terminal: No such file or directory at scratch.pl line + 13
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:
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"; }
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:
Cannot write to terminal: %s
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.
I 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?

Regards,
- Miller

In reply to IO::Prompt - Cannot write to terminal by wind

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.