| 1 | package TUI::Drivers::Event; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Unified event structure for input handling | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 139 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 139 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 139 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 139 | our $VERSION = '2.000003'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 139 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 139 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 139 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 139 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | TEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | new_TEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 139 | ▶ | use PerlX::Assert::PP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 139 | ▶ | use Hash::Util qw( lock_hash ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 139 | ▶ | use Scalar::Util qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | blessed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | looks_like_number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 139 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 139 | ▶ | use Tie::Hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 139 | ▶ | use TUI::Drivers::Const qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | :evXXXX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | kbAltShift | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | kbAltSpace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | kbDel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | kbCtrlShift | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | kbCtrlDel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | kbShift | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | kbShiftDel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | kbIns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | kbCtrlIns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | kbShiftIns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 139 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 139 | ▶ | use TUI::Drivers::HardwareInfo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # The following code section represents the 'MouseEventType' structure used for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # the 'THWMouse' and 'TEvent' class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 139 | package MouseEventType { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 139 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 139 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 139 | ▶ | use Devel::StrictMode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 139 | ▶ | use PerlX::Assert::PP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 139 | ▶ | use if STRICT => 'Hash::Util'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 139 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 139 | ▶ | use TUI::Objects::Point; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 139 | ▶ | our %HAS; BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | %HAS = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 176 | ▶ | eventFlags => sub { 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 176 | ▶ | controlKeyState => sub { 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 176 | ▶ | buttons => sub { 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 176 | ▶ | where => sub { TPoint->new() }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 139 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 181 | ▶ | sub new { # $obj (%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=21.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 139 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 181 | my ( $class, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 181 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | my $self = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | eventFlags => 0+ $args{eventFlags} || $HAS{eventFlags}->(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | controlKeyState => 0+ $args{controlKeyState} || $HAS{controlKeyState}->(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 181 | ▶ | buttons => 0+ $args{buttons} || $HAS{buttons}->(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
0 + $args{'eventFlags'} || $MouseEventType::HAS{'eventFlags'}->()
0 + $args{'controlKeyState'} || $MouseEventType::HAS{'controlKeyState'}->()
0 + $args{'buttons'} || $MouseEventType::HAS{'buttons'}->()
MC/DC50%1/2
0 + $args{'eventFlags'} || $MouseEventType::HAS{'eventFlags'}->()
0 + $args{'eventFlags'}
$MouseEventType::HAS{'eventFlags'}->()
MC/DC50%1/2
0 + $args{'controlKeyState'} || $MouseEventType::HAS{'controlKeyState'}->()
0 + $args{'controlKeyState'}
$MouseEventType::HAS{'controlKeyState'}->()
MC/DC50%1/2
0 + $args{'buttons'} || $MouseEventType::HAS{'buttons'}->()
0 + $args{'buttons'}
$MouseEventType::HAS{'buttons'}->()
Truth table66%2/3
A || B
A= 0 + $args{'eventFlags'}B= $MouseEventType::HAS{'eventFlags'}->()
Truth table66%2/3
A || B
A= 0 + $args{'controlKeyState'}B= $MouseEventType::HAS{'controlKeyState'}->()
Truth table66%2/3
A || B
A= 0 + $args{'buttons'}B= $MouseEventType::HAS{'buttons'}->()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 181 | my $type = ref $args{where}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 181 | ▶ | if ( $type eq 'HASH' || $type eq TPoint ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$type eq "HASH" or $type eq "TUI::Objects::Point"
MC/DC100%2/2
$type eq "HASH" or $type eq "TUI::Objects::Point"
$type eq "HASH"
$type eq "TUI::Objects::Point"
Truth table100%3/3
A or B
A= $type eq "HASH"B= $type eq "TUI::Objects::Point"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $self->{where} = TPoint->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | x => 0+ $args{where}{x}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | y => 0+ $args{where}{y}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | elsif ( $type eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | $self->{where} = TPoint->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | x => 0+ $args{where}->[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | y => 0+ $args{where}->[1], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 176 | $self->{where} = $HAS{where}->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 181 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 181 | Hash::Util::lock_keys( %$self ) if STRICT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 181 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } #/ sub MouseEventType::new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 10 | ▶ | sub clone { # $obj () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 10 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 10 | assert ( @_ == 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 10 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 10 | ▶ | my $class = ref $self || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ref $self || (return)
MC/DC0%0/1
ref $self || (return)
ref $self
Truth table50%1/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 10 | my $clone = bless { %$self }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 10 | Hash::Util::lock_keys( %$clone ) if STRICT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 10 | $clone->{where} = $self->{where}->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 10 | return $clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 139 | $INC{"MouseEventType.pm"} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # The following code section represents the 'CharScanType' structure used for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # the 'KeyDownEvent' class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 139 | package CharScanType { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 139 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 139 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 139 | ▶ | use PerlX::Assert::PP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 139 | ▶ | use Hash::Util qw( lock_hash ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 139 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 139 | ▶ | use Tie::Hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | our %HAS = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 11 | ▶ | scanCode => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 139 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 11 | my ( $this, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 11 | ▶ | $$this = ($$this & 0xff) + (0+$code << 8) if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 11 | $$this >> 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 9 | ▶ | charCode => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 139 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 9 | my ( $this, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 9 | ▶ | $$this = ($$this & ~0xff) + (0+$code & 0xff) if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 9 | $$this & 0xff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 139 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 139 | lock_hash( %HAS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 139 | ▶ | use parent 'Tie::Hash'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 10 | ▶ | sub new { # $obj (%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 10 | my ( $class, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 10 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 10 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 10 | tie %$self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 6 | map { $self->{$_} = $args{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 10 | grep { exists $args{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | keys %HAS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub clone { # $obj () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | assert ( @_ == 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | my $class = ref $self || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
ref $self || (return)
MC/DC0%0/1
ref $self || (return)
ref $self
Truth table0%0/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $clone = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | tie %$clone, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | map { $clone->{$_} = $self->{$_} } keys %HAS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | return $clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 10 | ▶ | sub TIEHASH { bless \( my $data ), $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEHASH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 10 | ▶ | sub STORE { $HAS{ $_[1] }->( $_[0], $_[2] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 11 | ▶ | sub FETCH { $HAS{ $_[1] }->( $_[0] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 3 | ▶ | sub FIRSTKEY { my $a = scalar keys %HAS; each %HAS } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FIRSTKEY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 6 | ▶ | sub NEXTKEY { each %HAS } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NEXTKEY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 7 | ▶ | sub EXISTS { exists $HAS{ $_[1] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EXISTS: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | ▶ | sub DELETE { delete $HAS{ $_[1] } } # raise an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DELETE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | ▶ | sub CLEAR { %HAS = () } # raise an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLEAR: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | sub SCALAR { scalar keys %HAS } # return number of elements (> 5.24) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SCALAR: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 139 | $INC{"CharScanType.pm"} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | # The following code section represents the 'KeyDownEvent' structure used for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # the 'TEvent' class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 139 | package KeyDownEvent { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 139 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 139 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 139 | ▶ | use PerlX::Assert::PP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 139 | ▶ | use Hash::Util qw( lock_hash ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 139 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 139 | ▶ | use Tie::Hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | our %HAS = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 19 | ▶ | keyCode => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 139 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 19 | my ( $this, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 19 | my $obj = tied %{ $this->[0] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 19 | ▶ | $$obj = 0+$code if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 19 | $$obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 6 | ▶ | charScan => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 6 | my ( $this, $obj ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 6 | ▶ | $this->[0] = $obj if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 6 | $this->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 16 | ▶ | controlKeyState => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 139 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 16 | my ( $this, $state ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 16 | ▶ | $this->[1] = 0+$state if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 16 | $this->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 139 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 139 | lock_hash( %HAS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 139 | ▶ | use parent 'Tie::Hash'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 4 | ▶ | sub new { # $obj (%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 4 | my ( $class, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 4 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 4 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 4 | tie %$self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 6 | map { $self->{$_} = $args{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 4 | grep { exists $args{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | keys %HAS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 4 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | sub clone { # $obj () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | assert ( @_ == 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $class = ref $self || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
ref $self || (return)
MC/DC0%0/1
ref $self || (return)
ref $self
Truth table0%0/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $clone = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | tie %$clone, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $clone->{keyCode} = $self->{keyCode}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $clone->{controlKeyState} = $self->{controlKeyState}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | return $clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 4 | ▶ | sub TIEHASH { bless [ CharScanType->new(), 0 ], $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEHASH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 16 | ▶ | sub STORE { $HAS{ $_[1] }->( $_[0], $_[2] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 25 | ▶ | sub FETCH { $HAS{ $_[1] }->( $_[0] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | ▶ | sub FIRSTKEY { my $a = scalar keys %HAS; each %HAS } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FIRSTKEY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 9 | ▶ | sub NEXTKEY { each %HAS } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NEXTKEY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 6 | ▶ | sub EXISTS { exists $HAS{ $_[1] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EXISTS: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub DELETE { delete $HAS{ $_[1] } } # raise an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DELETE: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | ▶ | sub CLEAR { %HAS = () } # raise an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLEAR: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | sub SCALAR { scalar keys %HAS } # return number of elements (> 5.24) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SCALAR: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 139 | $INC{"KeyDownEvent.pm"} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # The following code section represents the 'MessageEvent' structure used for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # the 'TEvent' class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 139 | package MessageEvent { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 139 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 139 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 139 | ▶ | use PerlX::Assert::PP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 139 | ▶ | use Hash::Util qw( lock_hash ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 139 | ▶ | use Hash::Util::FieldHash qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | id_2obj | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | register | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 139 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 139 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 139 | ▶ | use Tie::Hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | our %HAS = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 8 | ▶ | command => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 139 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 8 | my ( $this, $cmd ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 8 | ▶ | $this->[0] = 0+$cmd if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 8 | $this->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 9 | ▶ | infoPtr => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 9 | my ( $this, $info ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 9 | ▶ | if ( @_ > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 4 | $this->[1] = id $info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 4 | ▶ | register $info if ref $info; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 9 | ▶ | $this->[1] ? id_2obj $this->[1] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 8 | ▶ | infoLong => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 139 | ▶ | no warnings qw( uninitialized numeric ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 8 | my ( $this, $info ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 8 | ▶ | $this->[1] = 0+$info & 0xffff_ffff if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 8 | 0+$this->[1] & 0xffff_ffff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 7 | ▶ | infoWord => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 139 | ▶ | no warnings qw( uninitialized numeric ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 7 | my ( $this, $info ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 7 | ▶ | $this->[1] = 0+$info & 0xffff if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 7 | 0+$this->[1] & 0xffff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 9 | ▶ | infoInt => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 139 | ▶ | no warnings qw( uninitialized numeric ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 9 | my ( $this, $info ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 9 | ▶ | $this->[1] = 0+$info if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 9 | 0+$this->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 6 | ▶ | infoByte => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 139 | ▶ | no warnings qw( uninitialized numeric ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 6 | my ( $this, $info ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 6 | ▶ | $this->[1] = 0+$info & 0xff if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 6 | 0+$this->[1] & 0xff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 6 | ▶ | infoChar => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 139 | ▶ | no warnings qw( uninitialized numeric ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 6 | my ( $this, $info ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 6 | ▶ | $this->[1] = ord $_[1] if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 6 | chr( 0+$this->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 139 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 139 | lock_hash( %HAS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 139 | ▶ | use parent 'Tie::Hash'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 8 | ▶ | sub new { # $obj (%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 8 | my ( $class, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 8 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 8 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 8 | tie %$self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 11 | map { $self->{$_} = $args{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 8 | grep { exists $args{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | keys %HAS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 8 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } #/ sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | sub clone { # $obj () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | assert ( @_ == 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | my $class = ref $self || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
ref $self || (return)
MC/DC0%0/1
ref $self || (return)
ref $self
Truth table0%0/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | my $clone = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | tie %$clone, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $clone->{command} = $self->{command}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $clone->{infoInt} = $self->{infoInt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | return $clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 8 | ▶ | sub TIEHASH { bless [ 0, 0 ], $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEHASH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 20 | ▶ | sub STORE { $HAS{ $_[1] }->( $_[0], $_[2] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 33 | ▶ | sub FETCH { $HAS{ $_[1] }->( $_[0] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 3 | ▶ | sub FIRSTKEY { my $a = scalar keys %HAS; each %HAS } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FIRSTKEY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 21 | ▶ | sub NEXTKEY { each %HAS } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NEXTKEY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 14 | ▶ | sub EXISTS { exists $HAS{ $_[1] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EXISTS: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | ▶ | sub DELETE { delete $HAS{ $_[1] } } # raise an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DELETE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 1 | ▶ | sub CLEAR { %HAS = () } # raise an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLEAR: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | sub SCALAR { scalar keys %HAS } # return number of elements (> 5.24) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SCALAR: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 139 | $INC{"MessageEvent.pm"} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | sub TEvent() { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | sub new_TEvent { __PACKAGE__->from(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_TEvent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | our %HAS = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 26 | ▶ | what => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 26 | my ( $this, $what ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 26 | ▶ | if ( @_ > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 14 | assert ( looks_like_number $what ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 139 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 14 | $what += evNothing; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 14 | my $type = ref $this->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 14 | ▶ | if ( ( $what & evMouse ) && $type !~ /mouse/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$what & 15 and not $type =~ /mouse/iu
MC/DC0%0/2
$what & 15 and not $type =~ /mouse/iu
$what & 15
not $type =~ /mouse/iu
Truth table66%2/3
A and not(B)
A= $what & 15B= not $type =~ /mouse/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | @$this = ( $what, MouseEventType->new() ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | ▶ | elsif ( ( $what & evKeyboard ) && $type !~ /keyDown/i ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$what & 16 and not $type =~ /keyDown/iu
MC/DC0%0/2
$what & 16 and not $type =~ /keyDown/iu
$what & 16
not $type =~ /keyDown/iu
Truth table66%2/3
A and not(B)
A= $what & 16B= not $type =~ /keyDown/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | @$this = ( $what, KeyDownEvent->new() ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | ▶ | elsif ( ( $what & evMessage ) && $type !~ /message/i ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$what & 65280 and not $type =~ /message/iu
MC/DC0%0/2
$what & 65280 and not $type =~ /message/iu
$what & 65280
not $type =~ /message/iu
Truth table33%1/3
A and not(B)
A= $what & 65280B= not $type =~ /message/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | @$this = ( $what, MessageEvent->new() ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 14 | $this->[0] = $what; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 26 | $this->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 35 | ▶ | mouse => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 35 | my ( $this, $mouse ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 35 | ▶ | $this->[1] = $mouse if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 35 | my $type = ref $this->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 35 | ▶ | $type =~ /mouse/i ? $this->[1] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 21 | ▶ | keyDown => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 21 | my ( $this, $keyDown ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 21 | ▶ | $this->[1] = $keyDown if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 21 | my $type = ref $this->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 21 | ▶ | $type =~ /keyDown/i ? $this->[1] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 1 | ▶ | message => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 1 | my ( $this, $message ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 1 | ▶ | $this->[1] = $message if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 1 | my $type = ref $this->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 1 | ▶ | $type =~ /message/i ? $this->[1] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 139 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 139 | lock_hash( %HAS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 139 | ▶ | use parent 'Tie::Hash'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 66 | ▶ | sub new { # $obj (%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 139 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 66 | my ( $class, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 66 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 66 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 66 | tie %$self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 66 | my $this = tied %$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 66 | ▶ | assert ( !exists $args{what} or looks_like_number $args{what} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
!exists $args{'what'} || &looks_like_number($args{'what'})
MC/DC0%0/2
!exists $args{'what'} || &looks_like_number($args{'what'})
!exists $args{'what'}
&looks_like_number($args{'what'})
Truth table66%2/3
not(A) || B
A= !exists $args{'what'}B= &looks_like_number($args{'what'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 66 | ▶ | if ( $args{what} & evMouse ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | $this->[0] = $args{what}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | $this->[1] = MouseEventType->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 4 | map { $_ => $args{mouse}{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 1 | grep { exists $args{mouse}{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | qw( where eventFlags controlKeyState buttons ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | elsif ( $args{what} & evKeyboard ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | $this->[0] = $args{what}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | $this->[1] = KeyDownEvent->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 2 | map { $_ => $args{keyDown}{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 2 | grep { exists $args{keyDown}{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | qw( keyCode charScan controlKeyState ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | elsif ( $args{what} & evMessage ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | $this->[0] = $args{what}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | $this->[1] = MessageEvent->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 2 | map { $_ => $args{message}{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 1 | grep { exists $args{message}{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | qw( command infoPtr infoLong infoWord infoInt infoByte infoChar ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 66 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } #/ sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | sub from { # $obj () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table0%0/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | assert ( @_ == 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | return $class->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | sub dump { # $str (|$maxDepth) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: not called CC=2 SCAR=13.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | assert ( @_ == 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 139 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | require Data::Dumper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | local $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | local $Data::Dumper::Maxdepth = @_ ? shift : 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | my $str = Data::Dumper::Dumper $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $str =~ s/(^|\s)\$VAR\d+\b/$1'$self'/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | sub assign { # $self ($event) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
assign: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | my ( $self, $event ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | assert ( @_ == 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | assert ( blessed $event ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | $self->{what} = $event->{what}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | if ( $event->{mouse} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $self->{mouse} = $event->{mouse}->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | elsif ( $event->{keyDown} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $self->{keyDown} = $event->{keyDown}->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | elsif ( $event->{message} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $self->{message} = $event->{message}->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | sub clone { # $obj () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | assert ( @_ == 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | my $class = ref $self || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
ref $self || (return)
MC/DC0%0/1
ref $self || (return)
ref $self
Truth table0%0/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | my $clone = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | tie %$clone, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | $clone->{what} = $self->{what}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | if ( $self->{mouse} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $clone->{mouse} = $self->{mouse}->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | elsif ( $self->{keyDown} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $clone->{keyDown} = $self->{keyDown}->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | elsif ( $self->{message} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $clone->{message} = $self->{message}->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | return $clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 66 | ▶ | sub TIEHASH { bless [ evNothing, undef ], $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEHASH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 19 | ▶ | sub STORE { $HAS{ $_[1] }->( $_[0], $_[2] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 64 | ▶ | sub FETCH { $HAS{ $_[1] }->( $_[0] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | sub FIRSTKEY { my $a = scalar keys %HAS; each %HAS } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FIRSTKEY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | sub NEXTKEY { each %HAS } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NEXTKEY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | sub EXISTS { exists $HAS{ $_[1] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EXISTS: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | sub DELETE { delete $HAS{ $_[1] } } # raise an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DELETE: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | sub CLEAR { %HAS = () } # raise an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLEAR: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | sub SCALAR { scalar keys %HAS } # return number of elements (> 5.24) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SCALAR: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | sub getMouseEvent { # void ($self) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getMouseEvent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | assert ( blessed $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | require TUI::Drivers::EventQueue; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | TUI::Drivers::EventQueue->getMouseEvent( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 4 | ▶ | sub getKeyEvent { # void ($self) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getKeyEvent: called CC=12 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 4 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 4 | assert ( @_ == 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 4 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 4 | ▶ | if ( THardwareInfo->getKeyEvent( $self ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 3 | ▶ | return if $self->{what} != evKeyboard; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | # Need to handle special case of Alt-Space, Ctrl-Ins, Shift-Ins, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | # Ctrl-Del, Shift-Del | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 3 | SWITCH: for ( $self->{keyDown}{keyCode} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 3 | ▶ | $_ == ord(' ') and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 1 | ▶ | if ( $self->{keyDown}{controlKeyState} & kbAltShift ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 1 | $self->{keyDown}{keyCode} = kbAltSpace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 2 | ▶ | $_ == kbDel and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 1 | ▶ | if ( $self->{keyDown}{controlKeyState} & kbCtrlShift ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 1 | $self->{keyDown}{keyCode} = kbCtrlDel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | elsif ( $self->{keyDown}{controlKeyState} & kbShift ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | $self->{keyDown}{keyCode} = kbShiftDel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 1 | ▶ | $_ == kbIns and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 1 | ▶ | if ( $self->{keyDown}{controlKeyState} & kbCtrlShift ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | $self->{keyDown}{keyCode} = kbCtrlIns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | elsif ( $self->{keyDown}{controlKeyState} & kbShift ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 1 | $self->{keyDown}{keyCode} = kbShiftIns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } #/ SWITCH: for ( $self->{keyDown}{...}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } #/ if ( THardwareInfo->getKeyEvent...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 1 | $self->{what} = evNothing; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } #/ sub getKeyEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 139 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||