Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the Business-Hours CPAN distribution.

Report information
The Basics
Id: 25247
Status: resolved
Priority: 0/
Queue: Business-Hours

People
Owner: Nobody in particular
Requestors: fors [...] chalmers.se
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Infinite loop condition in first_after
Date: Fri, 02 Mar 2007 12:06:07 +0100
To: bug-business-hours [...] rt.cpan.org
From: Patrick Forsberg <fors [...] chalmers.se>
Hi there. There's a logical error in the first_after function of Business::Hours $MAXTIME is set to a fix number $period is set to a fix number less than $MAXTIME the while ($hours->empty) loop has function to exit if ($end >= $start + $MAXTIME) but at the end of the loop $start=$end and $end = $start+period so the exit condition will never be true; Something like this will solve the problem ########### --- Hours.pm 2005-07-08 17:44:00.000000000 +0200 +++ Hours.pm 2007-03-02 12:03:16.000000000 +0100 @@ -336,13 +336,14 @@ # the maximum time after which we stop searching for business hours my $MAXTIME = (30 * 24 * 60 * 60); # 30 days + my $ENDTIME = $start + $MAXTIME; my $period = (24 * 60 * 60); my $end = $start + $period; my $hours = new Set::IntSpan; while ($hours->empty) { - if ($end >= $start + $MAXTIME) { + if ($end >= $ENDTIME) { return -1; } $hours = $self->for_timespan(Start => $start, End => $end); ########### Regards, Patrick Forsberg
Resolved years ago by b295cbe1305482798c88911bf53d4c8363a31a60.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.