blib/lib/Linux/Termios2.pm

filter: Statementstmt 100% 10 / 10 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Linux/Termios2.xs ↑ Summary
1 # You may distribute under the terms of either the GNU General Public License
2 # or the Artistic License (the same terms as Perl itself)
3 #
4 # (C) Paul Evans, 2016 -- leonerd@leonerd.org.uk
5  
6 package Linux::Termios2;
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $VERSION = '0.01';
12  
13 1 require XSLoader;
14 1 XSLoader::load( __PACKAGE__, $VERSION );
15  
16 =head1 NAME
17  
18 C<Linux::Termios2> - wrap the F<Linux>-specific C<struct termios2> structure
19 and related
20  
21 =head1 SYNOPSIS
22  
23 This module is primarily intended as a helper for L<IO::Termios>, but it could
24 also be used directly.
25  
26 use Linux::Termios2;
27 use POSIX qw( TCSANOW );
28  
29 my $termios = Linux::Termios2->new;
30 $termios->getattr( 0 );
31  
32 $termios->setospeed( 123456 );
33  
34 $termios->setattr( 0, TCSANOW ) or
35 die "Cannot TCSETS2 - $!";
36  
37 =head1 DESCRIPTION
38  
39 This class provides an API equivalent to the L<POSIX::Termios> class, except
40 backed by the F<Linux>-specific C<struct termios2> structure instead.
41  
42 It uses the C<TCGETS2> and C<TCSETS2> family of C<ioctl()> calls, meaning it
43 has access to the arbitrary baud rate ability of the C<c_ispeed> and
44 C<c_ospeed> fields with the C<BOTHER> baud setting. These are accessed
45 transparently, by simply calling C<setispeed> and C<setospeed> with baud rates
46 in bits per second.
47  
48 =cut
49  
50 =head1 AUTHOR
51  
52 Paul Evans <leonerd@leonerd.org.uk>
53  
54 =cut
55  
56 1 0x55AA;
« lib/Linux/Termios2.xs ↑ Summary