perl5ever has asked for the wisdom of the Perl Monks concerning the following question:

Subject pretty much says it all. Is there a pure-perl version of Term::ReadKey?

Actually, all I need is a pure-perl implementation of ReadKey's ReadMode. I want to use IO::Prompt, and it looks like IO::Prompt only needs ReadMode.

Replies are listed 'Best First'.
Re: non-XS version of Term::ReadKey?
by Khen1950fx (Canon) on Feb 08, 2011 at 01:37 UTC
      Term::InKey is a good replacement for Term::ReadKey.

      Doesn't appear so

      http://cpansearch.perl.org/src/RAZINF/Term-InKey-1.04/Term/InKey.pm

      sub WinSetConsole { return $WIN32CONSOLE if $WIN32CONSOLE; require Win32::Console; import Win32::Console; { local *STDERR; open STDERR, ">/dev/null"; $WIN32CONSOLE = Win32::Console-> new(Win32::Console->STD_INPUT_HANDLE); } return $WIN32CONSOLE; }
      /dev/null on windows? and last updated in 2004
        Good point. Thanks.

        If that causes problems for you, then you can always fix it to:

        open STDERR, '>', 'NUL';
        Or take it up a notch with File::Spec::Win32:
        sub WinSetConsole { return $WIN32CONSOLE if $WIN32CONSOLE; require Win32::Console; import Win32::Console; { require File::Spec::Win32; my $devnull = File::Spec::Win32->devnull(); local *STDERR; open STDERR, '>', $devnull; $WIN32CONSOLE = Win32::Console-> new(Win32::Console->STD_INPUT_HANDLE); } return $WIN32CONSOLE; }
Re: non-XS version of Term::ReadKey?
by Anonymous Monk on Feb 07, 2011 at 16:55 UTC
    Is there a pure-perl version of Term::ReadKey?

    No, such a thing cannot exist (discounting Win32::API