NAME

Win32::Readch - Read individual characters from the keyboard using Win32::Console

SYNOPSIS

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";
}

DESCRIPTION

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).

AUTHOR

Klaus Eichner <klaus03@gmail.com>

COPYRIGHT AND LICENSE

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