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