Subject: | Warning if 'after' option is present but undefined |
Below is the relevant code fragment from timer.pm:
my $has_at = exists $arg{at};
my $has_after = exists $arg{after};
croak "'after' and 'at' are mutually exclusive"
if $has_at && $has_after;
if ($has_after) {
my $after = delete $arg{after};
$o->at(Event::time() + $after);
$has_at=1;
$o->interval($after) if !exists $arg{interval};
} elsif ($has_at) {
$o->at(delete $arg{at});
}
It turns out "after" key is present but the value is undefined, so I get a warning. I suggest to rewrite both $has_after and $has_at:
my $has_at = exists $arg{at} and defined($arg{at});
my $has_after = exists $arg{after} and defined($arg{after});