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.018';
3 2     2   16 use strict;
  2         4  
  2         63  
4 2     2   10 use warnings;
  2         4  
  2         47  
5 2     2   11 use JSON;
  2         4  
  2         13  
6 2     2   236 use Carp;
  2         5  
  2         144  
7 2     2   534 use parent 'JSON::Karabiner::Manipulator::Actions::To';
  2         330  
  2         12  
8              
9             sub new {
10 4     4 1 12 my $class = shift;
11 4         10 my ($type, $value) = @_;
12 4         7 my $has_delayed_action;
13 2     2   218 { no warnings 'once';
  2         4  
  2         300  
  4         7  
14 4         8 $has_delayed_action = $main::has_delayed_action;
15             }
16 4         8 my $obj;
17 4 100       13 if ($main::has_delayed_action) {
18 1         2 $obj = $main::has_delayed_action;
19             } else {
20 3         14 $obj = $class->SUPER::new('to_delayed_action', $value);
21 3         8 $obj->{data} = {};
22             }
23 4         13 $obj->{delayed_type} = 'canceled';
24 4 50       13 if ($value) {
25 0         0 $obj->{data} = $value,
26             } else {
27 4         11 $obj->{data}{to_if_canceled} = [];
28              
29             # $obj->{data}{to_delayed_action}{to_if_invoked} = [];
30             }
31 4         9 $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__