POSIX::1003::Termios - POSIX general terminal interface
POSIX::1003::Termios is a POSIX::1003::Module POSIX::1003::Termios is a POSIX::Termios
use POSIX::1003::Termios qw(:speed); $termios = POSIX::1003::Termios->new; $ispeed = $termios->getispeed; $termios->setospeed(B9600); use POSIX::1003::Termios qw(:functions :actions); tcsendbreak($fd, $duration); tcflush($fd, TCIFLUSH); $tty = ttyname($fd); $tty = ttyname($fh->fileno);
This module provides an interface to the "General Terminal Interfaces", as specified by POSIX. The actual implementation is part of POSIX.xs
See documentation in base class.
See "METHODS" in POSIX::1003::Module
Create a new Termios object. This object will be destroyed automatically when it is no longer needed. A Termios object corresponds to the termios C struct.
$termios = POSIX::1003::Termios->new;
Get terminal control attributes (POSIX function tcgetattr). Pass a file descriptor, which defaults to 0 (stdin). Returns undef on failure.
tcgetattr
0
undef
# Obtain the attributes for stdin $termios->getattr(0); $termios->getattr(); # Obtain the attributes for stdout $termios->getattr(1);
Retrieve a value from the c_cc field of a termios object. The c_cc field is an array so an index must be specified. $c_cc[1] = $termios->getcc(1);
c_cc
Retrieve the c_cflag field of a termios object. $c_cflag = $termios->getcflag;
c_cflag
Retrieve the c_iflag field of a termios object. $c_iflag = $termios->getiflag;
c_iflag
Retrieve the input baud rate. $ispeed = $termios->getispeed;
Retrieve the c_lflag field of a termios object. $c_lflag = $termios->getlflag;
c_lflag
Retrieve the c_oflag field of a termios object. $c_oflag = $termios->getoflag;
c_oflag
Retrieve the output baud rate. $ospeed = $termios->getospeed;
Set terminal control attributes (POSIX function tcsetattr). Returns undef on failure.
tcsetattr
# Set attributes immediately for stdout. $termios->setattr(1, TCSANOW);
Set a value in the c_cc field of a termios object. The c_cc field is an array so an index must be specified. $termios->setcc(VEOF, 1 );
Set the c_cflag field of a termios object. $termios->setcflag( $c_cflag | CLOCAL );
Set the c_iflag field of a termios object. $termios->setiflag( $c_iflag | BRKINT );
Set the input baud rate. Returns undef on failure. $termios->setispeed( B9600 );
Set the c_lflag field of a termios object. $termios->setlflag( $c_lflag | ECHO );
Set the c_oflag field of a termios object. $termios->setoflag( $c_oflag | OPOST );
Set the output baud rate. $termios->setospeed( B9600 );
See the possible ACTION values in "CONSTANTS", import tag :action
:action
See the possible QUEUE values in "CONSTANTS", import tag :flush
:flush
DURATION is system dependent.
Returns the path to the special device which relates to the file-descriptor. See also POSIX::1003::Proc::ctermid()
$tty = ttyname($fd); $tty = ttyname($fh->fileno);
:speed
B0 B50 B75 B110 B134 B150 B200 B300 B600 B1200 B1800 B2400 B4800 B9600 B19200 B38400
:actions
TCSADRAIN TCSANOW TCOON TCION TCSAFLUSH TCIOFF TCOOFF
TCIOFLUSH TCOFLUSH TCIFLUSH
:flags
VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN VTIME NCCS
CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD
BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON PARMRK
ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
OPOST
All constants, shown here with the values discovered during installation of this module:
B0 0 ICANON 2 TCIOFLUSH 2 B110 3 ICRNL 256 TCION 3 B1200 9 IEXTEN 32768 TCOFLUSH 1 B134 4 IGNBRK 1 TCOOFF 0 B150 5 IGNCR 128 TCOON 1 B1800 10 IGNPAR 4 TCSADRAIN 1 B19200 14 INLCR 64 TCSAFLUSH 2 B200 6 INPCK 16 TCSANOW 0 B2400 11 ISIG 1 TOSTOP 256 B300 7 ISTRIP 32 VEOF 4 B38400 15 IXOFF 4096 VEOL 11 B4800 12 IXON 1024 VERASE 2 B50 1 NCCS 32 VINTR 0 B600 8 NOFLSH 128 VKILL 3 B75 2 OPOST 1 VMIN 6 B9600 13 PARENB 256 VQUIT 1 BRKINT 2 PARMRK 8 VSTART 8 CLOCAL 2048 PARODD 512 VSTOP 9 ECHONL 64 TCIFLUSH 0 VSUSP 10 HUPCL 1024 TCIOFF 2 VTIME 5
This module is part of POSIX-1003 distribution version 0.94_3, built on June 10, 2013. Website: http://perl.overmeer.net. The code is based on POSIX, which is released with Perl itself. See also POSIX::Util for additional functionality.
Copyrights 2011-2013 on the perl code and the related documentation by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
To install POSIX::1003, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POSIX::1003
CPAN shell
perl -MCPAN -e shell install POSIX::1003
For more information on module installation, please visit the detailed CPAN module installation guide.