
pagaltzis at gmx
Mar 10, 2008, 7:59 PM
Post #6 of 9
(551 views)
Permalink
|
|
Re: Quick Catalyst::Plugin::SubRequest notes
[In reply to]
|
|
* Matt S Trout <dbix-class[at]trout.me.uk> [2008-03-10 22:35]: > On Mon, Mar 03, 2008 at 11:01:27PM +0100, Aristotle Pagaltzis wrote: > > sub is_subreq { > > my $self = shift; > > ref $self->engine eq > > 'Catalyst::Plugin::SubRequest::Internal::FakeEngine'; > > } > > I don't think that would be sufficient in the general case. What’s missing? From looking at the code, it seems like this should produce neither false negatives nor false positives. * Matt S Trout <dbix-class[at]trout.me.uk> [2008-03-10 22:35]: > On Mon, Mar 03, 2008 at 11:53:31AM +0100, Aristotle Pagaltzis wrote: > > 1. A way to return the entire ::Response object rather than > > just the body. > > Patches welcome. OK. Any suggestions for the name of such a method? That’s the only non-trivial part of writing one. > > 2. An `is_subrequest` query method that, obviously enough, > > returns true during a subrequest. > > That turns out to suck, because what happens if your subreq > needs to do some other subreq and handle that? Then you do need to twiddle the stash. But why should you *have* to, even if you never do make nested subrequests? > In any case, a subrequest should -by default- be transparent. The presence of a query method wouldn’t make the subrequest any less transparent: no controller *needs* to query the flag. > If you want to be able to tell, just include is_subrequest => 1 > in your stash stuff and test the stash var in your app code. That would be necessary in the general case where you want to be able to tell nested subrequests apart, yes. I still think it’s no skin off anyone’s back if there’s a built-in query method if you don’t need that. And honestly, it seems to me that if you start thinking about nesting subrequests, it’s probably time to restructure the app. > A doc patch showing how to do this would be welcome. Yes, good idea. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/> _______________________________________________ Catalyst-dev mailing list Catalyst-dev[at]lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
|