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 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 figured out that I can do this by having stop_now_dammit()
        use $r->notes() to set a note of the status code, call
        Apache->exit(), and have the downstream handler check the note.
        If it's anything but OK, simply return that value and the
        normal Apache error handline mechanism kicks in.  :)

        - Paul

Reply via email to