Solved. For anyone who might be interested:

I wanted to divert a request mid-execution without issuing a redirect, and didn't want to repeat some of my lower autohandler code (primarily, I wanted to retain the user instance I had just created after dealing with cookies, caches, auth from my DB, etc.) The answer was to issue a subrequest, then skip stuff I didn't want repeated by checking $m->is_subrequest. Thanks to everyone who weighed in.

RJ "yes, I'm running under CGI" Herrick

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







-------------------------------------------------------
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