Win32::Readch - Read individual characters from the keyboard using Win32::Console
use Win32::Readch qw(:all); # works in Windows even with umlauts under chcp 65001 (Utf-8) my $password = getstr_noecho('Please enter a password: '); print "Your password is '$password'\n"; my $text = getstr_echo('Please enter a text: '); print "Your text is '$text'\n"; print "Press a single keystroke\n"; my $ch1 = readch_block; print "Character '$ch1' has been pressed\n\n"; while (1) { my $ch2 = readch_timeout(990) // ''; # timeout in millisec last if $ch2 eq chr(27); print '', ($ch2 eq '' ? '--- Press <Esc> to terminate...' : "*** '$ch2'"), "\n"; }
This module goes to great length to make keyboard interaction happen in Windows under the most adverse circumstances, for example typing in umlauts under chcp 65001 (Utf-8).
Klaus Eichner <klaus03@gmail.com>
Copyright (C) 2012 by Klaus Eichner
All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the artistic license 2.0, see http://www.opensource.org/licenses/artistic-license-2.0.php
To install Win32::Readch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::Readch
CPAN shell
perl -MCPAN -e shell install Win32::Readch
For more information on module installation, please visit the detailed CPAN module installation guide.