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