File Coverage

blib/lib/JSON/Karabiner/Manipulator/Actions/To_delayed_if_invoked.pm
Criterion Covered Total %
statement 26 28 92.8
branch 2 4 50.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 35 39 89.7


line stmt bran cond sub pod time code
1             package JSON::Karabiner::Manipulator::Actions::To_delayed_if_invoked ;
2             $JSON::Karabiner::Manipulator::Actions::To_delayed_if_invoked::VERSION = '0.018';
3 3     3   22 use strict;
  3         7  
  3         91  
4 3     3   15 use warnings;
  3         7  
  3         68  
5 3     3   16 use JSON;
  3         6  
  3         18  
6 3     3   385 use Carp;
  3         6  
  3         207  
7 3     3   1721 use parent 'JSON::Karabiner::Manipulator::Actions::To';
  3         1009  
  3         17  
8              
9             sub new {
10 5     5 1 12 my $class = shift;
11 5         13 my ($type, $value) = @_;
12 5         11 my $obj;
13 5 50       16 if ($main::has_delayed_action) {
14 0         0 $obj = $main::has_delayed_action;
15             } else {
16 5         25 $obj = $class->SUPER::new('to_delayed_action', $value);
17 5         14 $obj->{data} = {};
18             }
19 5         16 $obj->{delayed_type} = 'invoked';
20 5 50       14 if ($value) {
21 0         0 $obj->{data} = $value,
22             } else {
23 5         13 $obj->{data}{to_if_invoked} = [];
24              
25             # $obj->{data}{to_delayed_action}{to_if_invoked} = [];
26             }
27 5         8 $main::has_delayed_action = $obj;
28 5         15 return $obj;
29             }
30              
31             # ABSTRACT: to_delayed_if_invoked action
32              
33             1;
34              
35             __END__