Linux::Termios2 - wrap the Linux-specific struct termios2 structure and related


This module is primarily intended as a helper for IO::Termios, but it could also be used directly.

 use Linux::Termios2;
 use POSIX qw( TCSANOW );

 my $termios = Linux::Termios2->new;
 $termios->getattr( 0 );

 $termios->setospeed( 123456 );

 $termios->setattr( 0, TCSANOW ) or
    die "Cannot TCSETS2 - $!";


This class provides an API equivalent to the POSIX::Termios class, except backed by the Linux-specific struct termios2 structure instead.

It uses the TCGETS2 and TCSETS2 family of ioctl() calls, meaning it has access to the arbitrary baud rate ability of the c_ispeed and c_ospeed fields with the BOTHER baud setting. These are accessed transparently, by simply calling setispeed and setospeed with baud rates in bits per second.


Paul Evans <>