Re: return from nested functions

2000-11-01 Thread Dave Rolsky
On Wed, 1 Nov 2000, Paul J. Lucas wrote: If I'm a few levels deep into function calls, I'd liek to be able to do something like "return SERVER_ERROR" and have the entire call stack unwind and the current request stopped. Is there any way to do that? Not that this

Re: return from nested functions

2000-11-01 Thread Ben Cottrell
On Wed, 1 Nov 2000 11:37:00 -0800 (PST), "Paul J. Lucas" wrote: If I'm a few levels deep into function calls, I'd liek to be able to do something like "return SERVER_ERROR" and have the entire call stack unwind and the current request stopped. Will something like this do

Re: return from nested functions

2000-11-01 Thread G.W. Haywood
Hi there, On Wed, 1 Nov 2000, Paul J. Lucas wrote: If I'm a few levels deep into function calls, I'd liek to be able to do something like "return SERVER_ERROR" and have the entire call stack unwind and the current request stopped. Is there any way to do that? It's

Re: return from nested functions

2000-11-01 Thread Paul J. Lucas
On Wed, 1 Nov 2000, G.W. Haywood wrote: Or you could call a function which does the business and then calls mod_perl's exit() function, page 464 Eagle Book. I tried exit: the status code isn't preserved to downstream stacked handlers. - Paul

Re: return from nested functions

2000-11-01 Thread Paul J. Lucas
On Wed, 1 Nov 2000, Dave Rolsky wrote: On Wed, 1 Nov 2000, Paul J. Lucas wrote: If I'm a few levels deep into function calls, I'd liek to be able to do something like "return SERVER_ERROR" and have the entire call stack unwind and the current request stopped. Is

Re: return from nested functions

2000-11-01 Thread Matt Sergeant
On Wed, 1 Nov 2000, Paul J. Lucas wrote: If I'm a few levels deep into function calls, I'd liek to be able to do something like "return SERVER_ERROR" and have the entire call stack unwind and the current request stopped. Is there any way to do that? Definitely use

Re: return from nested functions

2000-11-01 Thread Dave Rolsky
On Wed, 1 Nov 2000, Matt Sergeant wrote: Definitely use exceptions. I prefer Error.pm for this (sorry, Dave!), which allows your handler to simply be: That's no reason not to use Exception::Class. They are largely orthogonal. If you want to be able to declare your exception hierarchy at

Re: return from nested functions

2000-11-01 Thread Paul J. Lucas
On Wed, 1 Nov 2000, Matt Sergeant wrote: On Wed, 1 Nov 2000, Paul J. Lucas wrote: If I'm a few levels deep into function calls, I'd liek to be able to do something like "return SERVER_ERROR" and have the entire call stack unwind and the current request stopped. Is

Re: return from nested functions

2000-11-01 Thread Perrin Harkins
On Wed, 1 Nov 2000, Matt Sergeant wrote: Definitely use exceptions. I prefer Error.pm for this (sorry, Dave!), which allows your handler to simply be: sub handler { return try { ... } catch Exception::RetCode with { my $E = shift;

Re: return from nested functions

2000-11-01 Thread Paul J. Lucas
On Wed, 1 Nov 2000, Paul J. Lucas wrote: Ideally, I want to be able to do: sub foo { if ( $serious_problem ) stop_now_dammit( SERVER_ERROR ); } anywhere in the code like: sub

Re: return from nested functions

2000-11-01 Thread John K. Sterling
even better: Apache-exit(SERVER_ERROR);. or die SERVER_ERROR;. this is documented in the eagle book: ch9 - The Apache::Constants Class "... While the HTTP constants are generally used as return codes from handler subroutines, it is also possible to use the builtin die() function to jump out

Re: return from nested functions

2000-11-01 Thread John K. Sterling
On Wed, 1 Nov 2000, Paul J. Lucas wrote: On Wed, 1 Nov 2000, John K. Sterling wrote: even better: Apache-exit(SERVER_ERROR); The documentation for exit() deosnt' explicitly say you can do that. It mentions only "0" and "DONE" (see pp. 464-465). it works though,

Re: return from nested functions

2000-11-01 Thread Craig McLane
On Wed, 1 Nov 2000, Dave Rolsky wrote: On Wed, 1 Nov 2000, Paul J. Lucas wrote: If I'm a few levels deep into function calls, I'd liek to be able to do something like "return SERVER_ERROR" and have the entire call stack unwind and the current request stopped. Is