File Coverage

blib/lib/JSON/Karabiner/Manipulator/Actions/To_delayed_if_canceled.pm
Criterion Covered Total %
statement 33 34 97.0
branch 3 4 75.0
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 44 46 95.6


line stmt bran cond sub pod time code
1             package JSON::Karabiner::Manipulator::Actions::To_delayed_if_canceled ;
2             $JSON::Karabiner::Manipulator::Actions::To_delayed_if_canceled::VERSION = '0.017';
3 2     2   16 use strict;
  2         4  
  2         65  
4 2     2   11 use warnings;
  2         4  
  2         47  
5 2     2   10 use JSON;
  2         4  
  2         13  
6 2     2   237 use Carp;
  2         4  
  2         110  
7 2     2   465 use parent 'JSON::Karabiner::Manipulator::Actions::To';
  2         369  
  2         23  
8              
9             sub new {
10 4     4 1 10 my $class = shift;
11 4         12 my ($type, $value) = @_;
12 4         6 my $has_delayed_action;
13 2     2   234 { no warnings 'once';
  2         7  
  2         271  
  4         7  
14 4         9 $has_delayed_action = $main::has_delayed_action;
15             }
16 4         6 my $obj;
17 4 100       14 if ($main::has_delayed_action) {
18 1         3 $obj = $main::has_delayed_action;
19             } else {
20 3         13 $obj = $class->SUPER::new('to_delayed_action', $value);
21 3         7 $obj->{data} = {};
22             }
23 4         11 $obj->{delayed_type} = 'canceled';
24 4 50       11 if ($value) {
25 0         0 $obj->{data} = $value,
26             } else {
27 4         12 $obj->{data}{to_if_canceled} = [];
28              
29             # $obj->{data}{to_delayed_action}{to_if_invoked} = [];
30             }
31 4         10 $main::has_delayed_action = $obj;
32 4         10 return $obj;
33             }
34              
35             # ABSTRACT: to_delayed_if_canceled action
36              
37             1;
38              
39             __END__