Mit
use Term::ReadKey;
my $c = ReadKey;
Dump $c;
say "[$c]";
hat es funktioniert (Mit einem normalen
<STDIN> auch).
Es ist
type Datei_mit_Smily.txt | perl.pl
.
Mit
use Term::ReadKey;
use Encode::Locale;
ReadMode 3;
my $c = ReadKey;
$c = decode( 'console_in', $c );
Dump $c;
say "[$c]";
ReadMode 0;
gabs einen Fehler:
GetConsoleMode failed, LastError=|6| at C:/strawberry/perl/vendor/lib/Term/ReadKey.pm line 309.
Dieses Script hat mit dieser Methode nicht funktioniert:
use Win32::Console;
my $in = Win32::Console->new( STD_INPUT_HANDLE );
$in->Mode( ENABLE_PROCESSED_INPUT );
my $char = $in->InputChar();
Dump $char;
say "{$char}";
C:\Users\mm>type multibyte.txt | perl.pl
SV = NULL(0x0) at 0x12fe81c
REFCNT = 1
FLAGS = (PADMY)
Use of uninitialized value $char in concatenation (.) or string at C:\Users\mm\perl.pl line 23.
{}