Big5HKSCS
view release on metacpan or search on metacpan
lib/Big5HKSCS.pm view on Meta::CPAN
standard I/O library. Unfortunately, the standard I/O library is not so standard
as to provide a portable way to tell the underlying operating system to supply
unbuffered keyboard input to the standard I/O system. To do that, you have to
be slightly more clever, and in an operating-system-dependent fashion. Under
Unix you might say this:
if ($BSD_STYLE) {
system "stty cbreak </dev/tty >/dev/tty 2>&1";
}
else {
system "stty", "-icanon", "eol", "\001";
}
$key = Big5HKSCS::getc;
if ($BSD_STYLE) {
system "stty -cbreak </dev/tty >/dev/tty 2>&1";
}
else {
system "stty", "icanon", "eol", "^@"; # ASCII NUL
}
print "\n";
This code puts the next character typed on the terminal in the string $key. If
your stty program has options like cbreak, you'll need to use the code where
$BSD_STYLE is true. Otherwise, you'll need to use the code where it is false.
If you import getc "use Big5HKSCS qw(getc);", getc of your script will be rewritten
in Big5HKSCS::getc. Big5HKSCS::getc is not compatible with getc of JPerl.
lib/Big5HKSCS.pm view on Meta::CPAN
unbuffered. This function requests unbuffered input from the standard I/O library.
Unfortunately, the standard I/O library is not so standard as to provide a portable
way to tell the underlying operating system to supply unbuffered keyboard input to
the standard I/O system. To do that, you have to be slightly more clever, and in
an operating-system-dependent fashion. Under Unix you might say this:
if ($BSD_STYLE) {
system "stty cbreak </dev/tty >/dev/tty 2>&1";
}
else {
system "stty", "-icanon", "eol", "\001";
}
$key = CORE::getc;
if ($BSD_STYLE) {
system "stty -cbreak </dev/tty >/dev/tty 2>&1";
}
else {
system "stty", "icanon", "eol", "^@"; # ASCII NUL
}
print "\n";
This code puts the next single-byte typed on the terminal in the string $key.
If your stty program has options like cbreak, you'll need to use the code where
$BSD_STYLE is true. Otherwise, you'll need to use the code where it is false.
=item * Index by Byte String
$index = CORE::index($string,$substring,$offset);
( run in 1.428 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )