You might want to rethink using a plugin and instead just create a
custom controller that does what you want.  This has the advantage of
not employing any trickery, so it's easy to figure out what's going on.
   I prefer code that does what it says, rather than some magic that
gets mysteriously called during prepare()/finalize().  As mst indirectly
mentions, this can be prone to bugs, whereas your own controller (that
you can call from /begin or /auto and /end anyway) won't fall victim to
the unintended side effects here (i.e. calling prepare/finalize in other
plugins).

Your own controller is also easier to debug than the interaction between
a plugin, NEXT, and the Catalyst core :)

That said, how about the Larry Wall way:

my $me   = $c->uri_for(...);
my $page = `curl $me`;

Hopefully you're using myapp_server -f or the POE engine :/

:)

Regards,
Jonathan Rockway

Nate Wiger wrote:
> Is there a way to invoke a complete subrequest, with a complete request 
> cycle, in Catalyst? I've tried the Plugin::SubRequest and it's a step in 
> the right direction, but what I need is something that allows complete 
> prepare()/finalize() functionality.
> 
> I'm building an AJAX app with FormBuilder, and want to use it to embed 
> multiple forms in a page (each of which would be linked to a different 
> action and submitted using JQuery). I've found I can do this, but I've 
> had to make changes to the FB plugin so that it only instantiates an 
> object on a call to $c->form, and doesn't use prepare() to do so. This 
> then requires a bit of internal magic to work both normally and in 
> subrequest mode.
> 
> Other ideas?
> 
> -Nate
> 
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to