« Karabiner/Manipulator/Actions/To_if_held_down.pm
↑ Summary
Karabiner/Manipulator/Conditions/Device_unless.pm »
| 1 | package JSON::Karabiner::Manipulator::Conditions ; | ||
| 2 | $JSON::Karabiner::Manipulator::Conditions::VERSION = '0.008'; | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use JSON; | ||
| 6 | use Carp; | ||
| 7 | |||
| 8 | |||
| 9 | sub new { | ||
| 10 | my $class = shift; | ||
| 11 | my $type = shift; | ||
| 12 | |||
| 13 | my $self = { | ||
| 14 | def_name => $type, | ||
| 15 | |||
| 16 | }; | ||
| 17 | bless $self, $class; | ||
| 18 | return $self; | ||
| 19 | } | ||
| 20 | |||
| 21 | sub TO_JSON { | ||
| 22 | my $obj = shift; | ||
| 23 | use Data::Dumper qw(Dumper); | ||
| 24 | my $name = $obj->{def_name}; | ||
| 25 | my $value = $obj->{data}; | ||
| 26 | my @data_hash = @{$obj->{data}}; | ||
| 27 | my %super_hash = (); | ||
| 28 | foreach my $hash (@data_hash) { | ||
| 29 | my %hash = %$hash; | ||
| 30 | %super_hash = (%super_hash, %hash); | ||
| 31 | } | ||
| 32 | %super_hash = (%super_hash, type => $name); | ||
| 33 | return { %super_hash }; | ||
| 34 | |||
| 35 | } | ||
| 36 | |||
| 37 | # ABSTRACT: turns baubles into trinkets | ||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | __END__ |