Terminal-API
NAME
Terminal::API
Synopsis
use Terminal::API;
# Save the current terminal configuration.
my $saved-config = Terminal::API::get-config($*IN.native-descriptor);
# Restore the terminal to it's previously saved state.
Terminal::API::restore-config($*IN.native-descriptor, $saved-config, :when(FLUSH));
# Change the terminal to raw mode.
Terminal::API::make-raw($*IN.native-descriptor, :when(FLUSH));
# Retrieve the terminals window size.
my $size = Terminal::API::get-window-size($*OUT.native-descriptor);
say "{$size.rows} x {$size.cols}";
Description
Assorted APIs to deal with terminals.
Flags
Terminal::API::makeraw can take one of the following flags that determine
when the changes should take effect:
- NOW
- The default. The changes are applied immediately.
- DRAIN
- The changes are applied after all output written to the FD has been sent.
- FLUSH
- The changes are applied after all output written to the FD has been sent. All input that has been received but not read will be discarded.
AUTHOR
Patrick Böker <[email protected]>
Originally based on Term::termios by Karl Rune Nilsen et al.
License
This module is distributed under the terms of the Artistic License 2.0.