[Catalyst] Catalyst::Plugin::SubRequest

Brandon Black blblack at gmail.com
Tue Nov 29 15:12:26 CET 2005


On 11/24/05, Bill Moseley <moseley at hank.org> wrote:
> On Thu, Nov 24, 2005 at 04:08:18PM +0000, Will Hawes wrote:
> > I'm confused about the SubRequest plugin. In the synopsis, it says you
> > call it like this:
> >
> > $c->subreq('/foo');
> >
> > But that currently just gives me a blank screen. The only way I've been
> > able to get it working is
> >
> > $c->res->output( $c->subreq('/foo') );
>
> That's correct.
>
> I wish I had more time to help with documentation, because, at least
> for me, some of the docs are too brief and seem to assume the reader is
> thinking like the author.
>

I would assume that "thinking like the author" in the case of
SubRequest is that one might serve a page which contains, for
instance, 3 divs which can later be dynamically updated via AJAX
calls, which are in turn also served by Catalyst.  So the first time
around, you can use $c->subreq() to grab the output of those AJAX
calls and stuff them into your template for the whole page and serve
it.  Then later javascript code within the page might call back to
those subreq()'d methods directly to update the individual divs,
without any code duplication anywhere.



More information about the Catalyst mailing list