Have a look at Catalyst::Plugin::SubRequest.  That will allow you to
make a completely separate request to a different action, and it returns
the finished result in a variable.  Then it's up to you to write that
out to a file or do whatever with it.  You can even do the subrequest
call from your TT view and skip the writing to disk entirely if it suits
you better.

- Ted Carnahan

On Tue, 2006-08-01 at 04:18 +0100, Paul Makepeace wrote:
> I have an ordinary Cat app that needs to generate some subsidiary
> status output to a file that's then linked to in the main page's
> output. Originally I was going to do all the Template process etc
> myself but then wondered if there was a 'blessed' way of exploiting
> the catalyst machinery. Here's what I came up with,
> 
>       my ($self, $c) = @_;
>       my $template = $c->stash->{template};
>       $c->stash->{template} = 'news/subpage';
>       $c->forward('View::TT');
>       render_somewhere('news/status' => $c->response->out);
>       $c->response->output(''); # so the view is re-rendered
>       $c->stash->{template} = $template;
>         $c->stash->{status_page} = 'news/status';
> 
> What's nice about this is that news/subpage is found by catalyst - I'm
> wondering how much of render_somewhere() cat could help with. Doesn't
> have to follow that API, I just include that as an example; anything
> that gets the data down on disk will do.
> 
> Paul
> 
> _______________________________________________
> 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/


_______________________________________________
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