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 there any way to do that?
> 
> Definitely use exceptions.

        It's rather cumbersome.  Ideally, I want to be able to do:

                sub foo {
                        if ( $serious_problem )
                                stop_now_dammit( SERVER_ERROR );
                }

        anywhere in the code like:

                sub bar {
                        foo();
                }

        and I do *NOT* have to "catch" anything after the point of
        call, i.e., every call of foo() is similar to an "assertion" in
        C, i.e., if you get to the line of code after it, it worked; if
        it didn't work, you never get to the line after it.

        I suppose I want to do something like Apache->exit() but
        preserve the response code so the normal Apache error handling
        mechanism kicks in and handles the error.

        - Paul

Reply via email to