Re: breaking out of accept loop in perl?

G. Philip Reger (philr@peoplelink.com)
Wed, 21 May 1997 21:02:29 -0700

Message-Id: <3383C554.E9174136@peoplelink.com>
Date: Wed, 21 May 1997 21:02:29 -0700
From: "G. Philip Reger" <philr@peoplelink.com>
To: FastCGI Developers List <fastcgi-developers@OpenMarket.com>
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!";
        next;
    }

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

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

Is this the right way to do it?

phil

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.