Caroline
view release on metacpan or search on metacpan
lib/Caroline.pm view on Meta::CPAN
return $wchar;
}
sub readkey {
my $self = shift;
my $c = ReadKey(0);
return undef unless defined $c;
return $c unless $IS_WIN32;
# Win32 API always return the bytes encoded with ACP. So it must be
# decoded from double byte sequence. To detect double byte sequence, it
# use Win32 API IsDBCSLeadByte.
require Win32::API;
require Encode;
require Term::Encoding;
$self->{isleadbyte} ||= Win32::API->new(
'kernel32', 'int IsDBCSLeadByte(char a)',
);
$self->{encoding} ||= Term::Encoding::get_encoding();
if ($self->{isleadbyte}->Call($c)) {
$c .= ReadKey(0);
( run in 0.426 second using v1.01-cache-2.11-cpan-26ccb49234f )