Subject: | [PATCH] Protect against division by zero in POE::Resource::Statistics |
In lib/POE/Resource/Statistics.pm, there is a few lines, that suggest protection against division by zero, but the actual code only offers half protection, giving rise to spurious 'Illegal division by zero at lib/POE/Resource/Statistics.pm line 67' errors during tests.
This patch fixes the protection.
--cut--
$ diff -ru POE-0.33-orig/lib/POE/Resource/Statistics.pm POE-0.33/lib/POE/Resource/Statistics.pm
--- POE-0.33-orig/lib/POE/Resource/Statistics.pm 2005-05-15 09:00:12.000000000 +0200
+++ POE-0.33/lib/POE/Resource/Statistics.pm 2006-01-11 10:48:38.000000000 +0100
@@ -61,7 +61,7 @@
}
# Division by zero sucks.
- $average{blocked} ||= 0;
+ $average{interval} ||= 1;
$average{user_events} ||= 1;
POE::Kernel::_warn(
--cut--
Enjoy!
/Lars