« Karabiner/Manipulator/Actions/To_if_held_down.pm
↑ Summary
Karabiner/Manipulator/Conditions/Frontmost_application_unless.pm »
| 1 | package JSON::Karabiner::Manipulator::Conditions ; | ||
| 2 | 2 | $JSON::Karabiner::Manipulator::Conditions::VERSION = '0.018'; | |
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use JSON; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | |||
| 9 | 7 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 10 | 7 | my $class = shift; | |
| 11 | 7 | my $type = shift; | |
| 12 | |||
| 13 | 7 | my $self = { | |
| 14 | def_name => $type, | ||
| 15 | |||
| 16 | }; | ||
| 17 | 7 | bless $self, $class; | |
| 18 | { | ||
| 19 | 2 | ▶ | no warnings 'once'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 7 | $main::current_condition = $self; | |
| 21 | } | ||
| 22 | 7 | return $self; | |
| 23 | } | ||
| 24 | |||
| 25 | 2 | ▶ | sub TO_JSON { |
|
Subroutine
TO_JSON: called CC=2 SCAR=6.9
Pod
undocumented
| |||
| 26 | 2 | my $obj = shift; | |
| 27 | 2 | my $name = $obj->{def_name}; | |
| 28 | 2 | my $value = $obj->{data}; | |
| 29 | 2 | my @data_hash = @{$obj->{data}}; | |
| 30 | 2 | my %super_hash = (); | |
| 31 | 2 | foreach my $hash (@data_hash) { | |
| 32 | 4 | my %hash = %$hash; | |
| 33 | 4 | %super_hash = (%super_hash, %hash); | |
| 34 | } | ||
| 35 | 2 | %super_hash = (%super_hash, type => $name); | |
| 36 | 2 | return { %super_hash }; | |
| 37 | |||
| 38 | } | ||
| 39 | |||
| 40 | # ABSTRACT: parent class for condition classes | ||
| 41 | |||
| 42 | 2 | 1; | |
| 43 | |||
| 44 | __END__ | ||