[Catalyst] $c->forward and don't come back?

Christopher Heschong chris at wiw.org
Thu Jun 9 20:28:34 CEST 2005


I keep find myself often wanting to do the following:

sub foo : Local
{
   my ($self, $c, $id) = @_;

   MyApp::M::CDBI::Table->retrieve($id)
      or $c->forward('error');

   $c->stash->{template} = 'foo.tmpl';

}


sub error : Local
{
   my ($self, $c) = @_;
   $c->stash->{template} = 'error.tmpl';
}


The problem is, when I forward over to error, it does its work and then
comes back and finishes processing foo, setting the template to
'foo.xhtml'.  Is there something like forward that doesn't come back?  I
know there is $c->redirect but if I'm not mistaken that sends an HTTP
redirect, which isn't exactly what I was hoping for.

Thanks!




More information about the Catalyst mailing list