line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Karabiner::Manipulator::Actions ; |
2
|
|
|
|
|
|
|
$JSON::Karabiner::Manipulator::Actions::VERSION = '0.017'; |
3
|
13
|
|
|
13
|
|
6594
|
use strict; |
|
13
|
|
|
|
|
29
|
|
|
13
|
|
|
|
|
453
|
|
4
|
13
|
|
|
13
|
|
95
|
use warnings; |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
296
|
|
5
|
13
|
|
|
13
|
|
68
|
use JSON; |
|
13
|
|
|
|
|
25
|
|
|
13
|
|
|
|
|
69
|
|
6
|
13
|
|
|
13
|
|
1218
|
use Carp; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
1447
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
29
|
|
|
29
|
1
|
60
|
my $class = shift; |
10
|
29
|
|
|
|
|
52
|
my $type = shift; |
11
|
|
|
|
|
|
|
|
12
|
29
|
|
|
|
|
137
|
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
|
|
|
|
|
65
|
bless $self, $class; |
22
|
|
|
|
|
|
|
{ |
23
|
13
|
|
|
13
|
|
93
|
no warnings 'once'; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
2973
|
|
|
29
|
|
|
|
|
48
|
|
24
|
29
|
|
|
|
|
120
|
$main::current_action = $self; |
25
|
|
|
|
|
|
|
} |
26
|
29
|
|
|
|
|
82
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add_consumer_key_code { |
30
|
9
|
|
|
9
|
1
|
3225
|
my $s = shift; |
31
|
9
|
100
|
|
|
|
46
|
croak 'You must pass a value' if !$_[0]; |
32
|
8
|
|
|
|
|
28
|
$s->add_key_code(@_, 'consumer_key_code'); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub add_pointing_button { |
36
|
7
|
|
|
7
|
1
|
2759
|
my $s = shift; |
37
|
7
|
50
|
|
|
|
28
|
croak 'You must pass a value' if !$_[0]; |
38
|
7
|
|
|
|
|
37
|
$s->add_key_code(@_, 'pointing_button'); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _is_exclusive { |
42
|
103
|
|
|
103
|
|
171
|
my $s = shift; |
43
|
103
|
|
|
|
|
156
|
my $property = shift; |
44
|
103
|
50
|
|
|
|
218
|
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
|
|
|
|
|
255
|
$s->{$property} = 1; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# ABSTRACT: parent class for action classes |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |