The decision to derail the request is made after I do crazy stuff like authenticate and log a user into the system, so I can't put it any closer to the beginning. I started doing something similar to what you have suggested, using a 'redirected' flag and $m->redirect, I've switched to subexec... I'm not sure I see how I can retain my localized globals for the second execution, at least without writing some kludgy logic to wrap everything preceeding the divergence.

Is it possible (or wise) to alter the wrapping chain during execution? Where is $m->call_other when you need it? ;)

RJ

Gareth Kirwan wrote:

Sorry, I mis-read:
"because I want all the autohandler wrapping"
As:
"because I don't want all the autohandler wrapping"

I'd say subexec with a flag that allows the handlers to see not to redo
certain things,
Or put the logic that decides if a redirect is necessary right at the start
of the top inherited handler, so it can easilly redirect
Before any processing is really done.

Catalyst might be a good option.

I haven't used it myself, but I hear it does cool things.

G

-----Original Message-----
From: Gareth Kirwan [mailto:[EMAIL PROTECTED] Sent: 11 March 2006 09:11
To: 'RJ Herrick'; 'Mason List'
Subject: RE: [Mason] Diverting request mid-stream

$m->comp('x') doesn't call the autohandlers for that component.

So you can just do:

If (my $alt = $user->Redirected){
        $m->comp($alt);
        }
Else {
        $m->call_next;
        }

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of RJ Herrick
Sent: 11 March 2006 05:05
To: Mason List
Subject: [Mason] Diverting request mid-stream

Hello all,
On some requestes I would like to effectively change the requested component mid-stream. Something like this:
<c>
if (my $alt = $user->Redirected) {
$m->?unknown_method?($alt);
} else {
$m->call_next;
}
</c>

Currently, my thoughts are:
I don't want to call redirect, because I want to go through my <%cleanup>, not abort mid-request. I don't want to call subexec, because I don't want to start at the beginning of the request again (specifically, execute the base syshandler). I don't want to call comp, because I want all the autohandler wrapping between here and the component I'm diverting to.

Is this possible? What am I overlooking or misunderstanding?

Thanks,
RJ

"A foolish consistency is the hobgoblin of little minds" -Ralph Waldo Emerson



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&;
dat=121642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users







--
"A foolish consistency is the hobgoblin of little minds" -Ralph Waldo Emerson



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to