in reply to IO::Prompt - Cannot write to terminal

Hi wind,

Neither Expect nor IO::Prompt work on Windows (though, faik, both may work under Cygwin.)

Afaict, the ppm package exists because none of the tests fail. (Even the cpantesters report it as passing on Windows.) But the tests pass on Windows only because they don't actually test the functionality of the module ... I wonder how that trick rates under "Perl's Best Practices" :-)

Win32::Console comes to mind as a possible replacement.

Cheers,
Rob
  • Comment on Re: IO::Prompt - Cannot write to terminal

Replies are listed 'Best First'.
Re^2: IO::Prompt - Cannot write to terminal
by wind (Priest) on Jul 21, 2007 at 01:48 UTC
    Expect is reported to work on Cygwin but not on ActivePerl:

    Expect FAQ Can I use this module with ActivePerl on Windows?

    However, IO::Prompt says nothing about its usability on alternate systems. It has a list of DEPENDENCIES, all which install without error under ActivePerl along with the module itself. I definitely consider that very bad practice, and will send an email to the module maintainer suggestion that he at the very least add a FAQ entry.

    Thanks,
    - Miller

      The module makes no attempt at portability. It opens dev/tty unconditionally. You can get the prompt to display by changing the first few lines of sub prompt, but after that you are in a world of hurt.

      open $OUT, ($^O eq 'MSWin32' ) ? '>CON' : ">/dev/tty" or croak "Cannot write to terminal: $!" if !$OUT; $OUT->autoflush(1); @prompt = $flags{ -prompt } if !@prompt and $flags{ -prompt }; my $IN; if ($flags{-tty} || $flags{-argv}) { open $IN, ($^O eq 'MSWin32' ) ? '<CON' : ">/dev/tty" or croak "Cannot read from terminal: $!"; }

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        I noticed. The only test script is 00.load.t, which as its name implies only requires that the module be able to load.

        I plan on sending him a new test script named 01.dependencies.t
        use Test::More tests => 2; # Depends on hardcoded /dev/tty access ok( open(my $OUT, ">/dev/tty"), "Output to /dev/tty"); ok( open(my $IN, "</dev/tty"), "Input from /dev/tty");
        Any bet on whether or not he'll actually include it in the release?

        - Miller