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.017';
3 3     3   21 use strict;
  3         8  
  3         100  
4 3     3   15 use warnings;
  3         7  
  3         71  
5 3     3   16 use JSON;
  3         6  
  3         19  
6 3     3   412 use Carp;
  3         7  
  3         224  
7 3     3   1488 use parent 'JSON::Karabiner::Manipulator::Actions::To';
  3         1021  
  3         18  
8              
9             sub new {
10 5     5 1 13 my $class = shift;
11 5         16 my ($type, $value) = @_;
12 5         9 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         57 $obj->{data} = {};
18             }
19 5         16 $obj->{delayed_type} = 'invoked';
20 5 50       13 if ($value) {
21 0         0 $obj->{data} = $value,
22             } else {
23 5         11 $obj->{data}{to_if_invoked} = [];
24              
25             # $obj->{data}{to_delayed_action}{to_if_invoked} = [];
26             }
27 5         9 $main::has_delayed_action = $obj;
28 5         18 return $obj;
29             }
30              
31             # ABSTRACT: to_delayed_if_invoked action
32              
33             1;
34              
35             __END__