----- Original Message -----
From: "Mark Stosberg" <suppressed>
> On 2003-11-02, Cees Hek <suppressed> wrote:
> >
> > Inside your runmode just return the results of another runmode... Here
is some
> > pseudocode
>
> If the subroutine might die, you could trap that in your run mode:
>
> eval{ $result = _my_tricky_sub() };
> return $self->error_runmode($@) if $@;
Cees, Mark, thanks that will work perfectly. I didn't realize I could return
the output of another runmode (which would only be called in the case of an
error.) And yes, I might get 3-4 levels deep in a subroutine where it's not
easy to pass back error codes just to terminate in an error display. The die
within an "eval" will make it as easy as I hoped it could be.
Here's another question:
I use "cgiapp_init" to retrieve session tracking from a MySQL table, and
determine if the visitor needs to sign in (either because no
session-tracking row was found or the information expired due to
inactivity). I know how to redirect to the "login" application. But, I don't
know how to do this inside "cgiapp_init". (It's not a method that emits
output?)
I know I can set a flag and reference it in "setup" to make a run_mode
happen (outputs nothing so that only the headers already set in
"cgiapp_init" are emitted). But, I'm wondering if there's a more orthodox
way to do this.
Thanks,
Mark
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.