Subject: | Numeric sort on "*" throws warning |
The warning
Argument "*" isn't numeric in sort at /usr/local/share/perl/5.8.7/Schedule/Cron.pm line
907.
is thrown by Schedule::Cron. Apparently under some circumstances perl does not bother to
call a custom sort function when sorting an array of size 1, but under others it does. I'm
unable to come up with a good small test case but when running my code, calling $cron-
Show quoted text
>get_next_execution_time("0-59 * * * *", time) produces four lines of the above warning, one
for each "*".
If you want a small test case I can probably produce one with some effort. However, the fix is
pretty simple:
--- Cron.pm.orig 2005-01-03 12:25:19.000000000 -0500
+++ Cron.pm 2006-02-14 14:26:52.000000000 -0500
@@ -904,7 +904,7 @@
push @res,$t;
}
}
- push @expanded, [ sort { $a <=> $b} @res];
+ push @expanded, ($#res == 0 && $res[0] eq '*') ? [@res] : [ sort { $a <=> $b} @res];
}
# Calculating time: