line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Karabiner::Rule ; |
2
|
|
|
|
|
|
|
$JSON::Karabiner::Rule::VERSION = '0.017'; |
3
|
19
|
|
|
19
|
|
138
|
use strict; |
|
19
|
|
|
|
|
43
|
|
|
19
|
|
|
|
|
572
|
|
4
|
19
|
|
|
19
|
|
109
|
use warnings; |
|
19
|
|
|
|
|
39
|
|
|
19
|
|
|
|
|
641
|
|
5
|
|
|
|
|
|
|
require JSON::Karabiner::Manipulator ; |
6
|
19
|
|
|
19
|
|
101
|
use Carp; |
|
19
|
|
|
|
|
39
|
|
|
19
|
|
|
|
|
5206
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
28
|
|
|
28
|
0
|
55
|
my $class = shift; |
10
|
28
|
|
|
|
|
50
|
my $desc = shift; |
11
|
28
|
50
|
|
|
|
66
|
croak 'JSON::Karabiner constructor requires a desc.' if !$desc; |
12
|
28
|
|
|
|
|
107
|
my $self = { |
13
|
|
|
|
|
|
|
description => $desc, |
14
|
|
|
|
|
|
|
manipulators => [] |
15
|
|
|
|
|
|
|
}; |
16
|
28
|
|
|
|
|
64
|
bless $self, $class; |
17
|
28
|
|
|
|
|
63
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _disable_validity_tests { |
21
|
42
|
|
|
42
|
|
77
|
my $s = shift; |
22
|
42
|
|
|
|
|
76
|
my $enable = shift; |
23
|
|
|
|
|
|
|
|
24
|
42
|
100
|
|
|
|
111
|
my $op = $enable ? 0 : 1; |
25
|
42
|
|
|
|
|
84
|
foreach my $manip (@{$s->{manipulators}}) { |
|
42
|
|
|
|
|
155
|
|
26
|
42
|
|
|
|
|
1737
|
$manip->{_disable_validity_tests} = $op; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _enable_validity_tests { |
31
|
21
|
|
|
21
|
|
57
|
my $s = shift; |
32
|
21
|
|
|
|
|
61
|
$s->_disable_validity_tests(1); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub add_manipulator { |
36
|
27
|
|
|
27
|
1
|
381
|
my $s = shift; |
37
|
|
|
|
|
|
|
|
38
|
27
|
|
|
|
|
144
|
my $manip = JSON::Karabiner::Manipulator->new_manipulator(); |
39
|
27
|
|
|
|
|
50
|
push @{$s->{manipulators}}, $manip; |
|
27
|
|
|
|
|
101
|
|
40
|
27
|
|
|
|
|
90
|
return $manip; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
24
|
|
|
24
|
0
|
57
|
sub TO_JSON { return { %{ shift() } }; } |
|
24
|
|
|
|
|
219
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# ABSTRACT: turns baubles into trinkets |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |