File Coverage

blib/lib/JSON/Karabiner/Manipulator/Actions/To_delayed_if_canceled.pm
Criterion Covered Total %
statement 37 38 97.3
branch 3 4 75.0
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 49 51 96.0


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.016';
3 2     2   15 use strict;
  2         6  
  2         74  
4 2     2   10 use warnings;
  2         5  
  2         45  
5 2     2   10 use JSON;
  2         4  
  2         15  
6 2     2   254 use Carp;
  2         5  
  2         151  
7 2     2   521 use parent 'JSON::Karabiner::Manipulator::Actions::To';
  2         344  
  2         20  
8              
9             sub new {
10 4     4 1 9 my $class = shift;
11 4         15 my ($type, $value) = @_;
12 4         7 my $has_delayed_action;
13 2     2   221 { no warnings 'once';
  2         12  
  2         115  
  4         5  
14 4         8 $has_delayed_action = $main::has_delayed_action;
15             }
16 4         9 my $obj;
17 4 100       11 if ($main::has_delayed_action) {
18 2     2   14 use Data::Dumper qw(Dumper);
  2         5  
  2         331  
19 1         4 print Dumper 'kajskfj';
20 1         233 $obj = $main::has_delayed_action;
21             } else {
22 3         14 $obj = $class->SUPER::new('to_delayed_action', $value);
23 3         11 $obj->{data} = {};
24             }
25 4         12 $obj->{delayed_type} = 'canceled';
26 4 50       11 if ($value) {
27 0         0 $obj->{data} = $value,
28             } else {
29 4         22 $obj->{data}{to_if_canceled} = [];
30              
31             # $obj->{data}{to_delayed_action}{to_if_invoked} = [];
32             }
33 4         7 $main::has_delayed_action = $obj;
34 4         12 return $obj;
35             }
36              
37             # ABSTRACT: to_delayed_if_canceled action
38              
39             1;
40              
41             __END__