line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Karabiner::Manipulator::Actions ; |
2
|
|
|
|
|
|
|
$JSON::Karabiner::Manipulator::Actions::VERSION = '0.018'; |
3
|
13
|
|
|
13
|
|
6646
|
use strict; |
|
13
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
430
|
|
4
|
13
|
|
|
13
|
|
88
|
use warnings; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
354
|
|
5
|
13
|
|
|
13
|
|
63
|
use JSON; |
|
13
|
|
|
|
|
25
|
|
|
13
|
|
|
|
|
68
|
|
6
|
13
|
|
|
13
|
|
1325
|
use Carp; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
1415
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
29
|
|
|
29
|
1
|
59
|
my $class = shift; |
10
|
29
|
|
|
|
|
53
|
my $type = shift; |
11
|
|
|
|
|
|
|
|
12
|
29
|
|
|
|
|
147
|
my $self = { |
13
|
|
|
|
|
|
|
def_name => $type, |
14
|
|
|
|
|
|
|
consumer_key_code => 0, |
15
|
|
|
|
|
|
|
pointing_button => 0, |
16
|
|
|
|
|
|
|
key_code => 0, |
17
|
|
|
|
|
|
|
any => 0, |
18
|
|
|
|
|
|
|
last_key_code => '', |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
}; |
21
|
29
|
|
|
|
|
66
|
bless $self, $class; |
22
|
|
|
|
|
|
|
{ |
23
|
13
|
|
|
13
|
|
96
|
no warnings 'once'; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
2906
|
|
|
29
|
|
|
|
|
54
|
|
24
|
29
|
|
|
|
|
77
|
$main::current_action = $self; |
25
|
|
|
|
|
|
|
} |
26
|
29
|
|
|
|
|
78
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add_consumer_key_code { |
30
|
9
|
|
|
9
|
1
|
3404
|
my $s = shift; |
31
|
9
|
100
|
|
|
|
48
|
croak 'You must pass a value' if !$_[0]; |
32
|
8
|
|
|
|
|
29
|
$s->add_key_code(@_, 'consumer_key_code'); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub add_pointing_button { |
36
|
7
|
|
|
7
|
1
|
2912
|
my $s = shift; |
37
|
7
|
50
|
|
|
|
28
|
croak 'You must pass a value' if !$_[0]; |
38
|
7
|
|
|
|
|
26
|
$s->add_key_code(@_, 'pointing_button'); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _is_exclusive { |
42
|
103
|
|
|
103
|
|
195
|
my $s = shift; |
43
|
103
|
|
|
|
|
158
|
my $property = shift; |
44
|
103
|
50
|
|
|
|
227
|
croak 'No property passed' unless $property; |
45
|
|
|
|
|
|
|
# my $is_exclusive = !grep { !$s->{$_} unless $_ eq $property } qw(shell_command select_input_source set_variable mouse_key consumer_key_code pointing_button key_code); |
46
|
|
|
|
|
|
|
# croak 'Property already set that conflicts with the propert you are trying to set' unless $is_exclusive; |
47
|
103
|
|
|
|
|
254
|
$s->{$property} = 1; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# ABSTRACT: parent class for action classes |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |