Re: breaking out of accept loop in perl?

G. Philip Reger (
Wed, 21 May 1997 21:02:29 -0700

Message-Id: <>
Date: Wed, 21 May 1997 21:02:29 -0700
From: "G. Philip Reger" <>
To: FastCGI Developers List <>
Subject: Re: breaking out of accept loop in perl?

Sorry I wasn't specific..

During the course of an iteration there are conditions that need to
result in the loop stopping and closing the connection to the client.

The way I found to do this is call next. Break and last did not work.

For instance:

while (FCGI::accept() >= 0) {
    if ($var ne "go") {
        [halt execution and move on to the next request]
        print "var is not go!";

    if ($var1 ne "go away") {
        [halt and move on]
        print "var is not go away!";

See? This way accept will continue to service requests without
completely exiting.

Is this the right way to do it?


Jonathan Roy wrote:
>   I do something like this:
> $mycount = 0;
> while(FCGI::accept() >= 0) {
>     $mycount++ > 300 and last;
> }
> FCGI::finish();
> exit();

G. Philip Reger
Mgr. Systems Operations
PeopleLink, Inc. - Connect. Communicate. Simply.