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 25     25   169 use strict;
  25         47  
  25         899  
2             package Event::idle;
3 25     25   131 use Carp;
  25         43  
  25         1374  
4 25     25   140 use base 'Event::Watcher';
  25         52  
  25         2453  
5 25     25   146 use vars qw($DefaultPriority @ATTRIBUTE);
  25         45  
  25         6158  
6              
7             @ATTRIBUTE = qw(hard max min);
8              
9             'Event::Watcher'->register;
10              
11             sub new {
12             # lock %Event::;
13              
14 13     13 0 29 my $class = shift;
15 13         50 my %arg = @_;
16 13   50     726 my $o = allocate($class, delete $arg{attach_to} || {});
17            
18             # deprecated
19 13         45 for (qw(min max repeat)) {
20 39 50       115 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         94 $o->init(\%arg);
28 13         61 $o;
29             }
30              
31             1;