> I'd like to be able to prematurely end the thread of execution
> within a Perl apache module from someplace *other than* the
> PerlHandler entry point subroutine (usually "handler()").  That is,
> when I'm a few subroutines deep inside my module, I want to be able
> to spit out an error page and have the module finish as if handler()
> had returned OK.  Right now I'm painstakingly propagating return
> values back up to my handler() subroutine, but I'm hoping there's a
> better way.
> 

You could use "eval" and "die", Perl's standard exception mechanism.

sub handler
{
    my $r = shift;
    eval {
        foo();
    }
    warn $@ if $@;
}

sub foo
{
    goo();
}

sub goo
{
    ...
    die "prematurely" if $some_condition;
}

--
Eric

Reply via email to