« Karabiner/Manipulator/Conditions/Frontmost_application_if.pm
↑ Summary
Karabiner/Manipulator/Conditions/Device_if.pm »
| 1 | package JSON::Karabiner::Manipulator::Actions ; | ||||||||||
| 2 | 1 | $JSON::Karabiner::Manipulator::Actions::VERSION = '0.008'; | |||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub new { | ||||||||||
| 9 | 2 | ▶ | my $class = shift; | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 10 | 2 | my $type = shift; | |||||||||
| 11 | |||||||||||
| 12 | 2 | 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 | 2 | bless $self, $class; | |||||||||
| 22 | 2 | return $self; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | sub add_consumer_key_code { | ||||||||||
| 26 | 0 | ▶ | my $s = shift; | ||||||||
|
Subroutine
add_consumer_key_code: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 27 | 0 | ▶ | croak 'You must pass a value' if !$_[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | $s->add_key_code(@_, 'consumer_key_code'); | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | sub add_pointing_button { | ||||||||||
| 32 | 0 | ▶ | my $s = shift; | ||||||||
|
Subroutine
add_pointing_button: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 33 | 0 | ▶ | croak 'You must pass a value' if !$_[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | $s->add_key_code(@_, 'pointing_button'); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | sub _is_exclusive { | ||||||||||
| 38 | 0 | ▶ | my $s = shift; | ||||||||
|
Subroutine
_is_exclusive: not called CC=2 SCAR=17.9
| |||||||||||
| 39 | 0 | my $property = shift; | |||||||||
| 40 | 0 | ▶ | croak 'No property passed' unless $property; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | # 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); | ||||||||||
| 42 | # croak 'Property already set that conflicts with the propert you are trying to set' unless $is_exclusive; | ||||||||||
| 43 | 0 | $s->{$property} = 1; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | sub TO_JSON { | ||||||||||
| 47 | 0 | ▶ | my $obj = shift; | ||||||||
|
Subroutine
TO_JSON: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 48 | 0 | my $name = $obj->{def_name}; | |||||||||
| 49 | 0 | my $value = $obj->{data}; | |||||||||
| 50 | 0 | return { $name => $value }; | |||||||||
| 51 | |||||||||||
| 52 | # return { %{ shift() } }; | ||||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | # ABSTRACT: parent class for action classes | ||||||||||
| 56 | |||||||||||
| 57 | 1 | 1; | |||||||||
| 58 | |||||||||||
| 59 | __END__ | ||||||||||