File Coverage

blib/lib/Event/idle.pm
Criterion Covered Total %
statement 20 22 90.9
branch 2 4 50.0
condition 2 5 40.0
subroutine 5 5 100.0
pod 0 1 0.0
total 29 37 78.3


line stmt bran cond sub pod time code
1 24     24   152 use strict;
  24         49  
  24         822  
2             package Event::idle;
3 24     24   144 use Carp;
  24         43  
  24         1214  
4 24     24   124 use base 'Event::Watcher';
  24         44  
  24         2124  
5 24     24   146 use vars qw($DefaultPriority @ATTRIBUTE);
  24         38  
  24         5735  
6              
7             @ATTRIBUTE = qw(hard max min);
8              
9             'Event::Watcher'->register;
10              
11             sub new {
12             # lock %Event::;
13              
14 13     13 0 27 my $class = shift;
15 13         46 my %arg = @_;
16 13   50     658 my $o = allocate($class, delete $arg{attach_to} || {});
17            
18             # deprecated
19 13         46 for (qw(min max repeat)) {
20 39 50       117 if (exists $arg{"e_$_"}) {
21 0         0 carp "'e_$_' is renamed to '$_'";
22 0         0 $arg{$_} = delete $arg{"e_$_"};
23             }
24             }
25              
26 13 50 33     77 $o->repeat(1) if defined $arg{min} || defined $arg{max};
27 13         88 $o->init(\%arg);
28 13         61 $o;
29             }
30              
31             1;