lib/Linux/Input/Joystick.pm

filter: Statementstmt 50.0% 11 / 22 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 44.1% 15 / 34 CC 3 SCAR 18.7
CC
3
Cov
41%
poll
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« lib/Linux/Input.pm ↑ Summary script/evtest.pl »
1 package Linux::Input::Joystick;
2  
3 1 ▶use base 'Linux::Input';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # class data
8 1 Linux::Input::Joystick->event_bytes(8);
9  
10 # return all pending events
11 0 ▶sub poll {
Subroutine poll: not called CC=3 SCAR=24.8
Pod documented
12 0 my $self = shift;
13 0 ▶ my $timeout = shift || ref($self)->timeout();
Condition0%0/3
shift() || ref($self)->timeout
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || ref($self)->timeout
shift() ref($self)->timeout
Truth table0%0/3
A || B
A= shift()B= ref($self)->timeout
ABresult
1X1
011
000
14 0 my $selector = $self->selector();
15 0 my @ev;
16 0 ▶ while (my ($fh) = $selector->can_read($timeout)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($fh) = $selector->can_read($timeout)) 0 0 0
17 0 my $buffer;
18 0 my $len = sysread($fh, $buffer, Linux::Input::Joystick->event_bytes);
19 0 my ($time, $value, $type, $number) =
20 unpack('LsCC', $buffer);
21 0 my $event = {
22 time => $time,
23 type => $type,
24 number => $number,
25 value => $value,
26 };
27 0 push @ev, $event;
28 }
29 0 return @ev;
30 }
31  
32 1 1;
33  
34 __END__
« lib/Linux/Input.pm ↑ Summary script/evtest.pl »