[Catalyst] Has $c->response->redirect behaviour changed?
Alex Kavanagh
alex at tinwood.homelinux.org
Wed Jan 25 12:59:17 CET 2006
At Wed, 25 Jan 2006 11:42:57 +0000,
Chisel Wright wrote:
>
> On Wed, Jan 25, 2006 at 11:19:12AM +0000, Alex Kavanagh wrote:
> > Indeed! In my mucking around with things I had left an 'end' sub hanging
> > around in one of my controllers which was defeating DefaultEnd. Once
> > I had removed it, it worked like a treat. All I can suggest is the
> > debug from the standalone server which lists which actions were run
> > through.
>
> I'm combining my end() and DefaultEnd with next magic:
>
> ---- cut here ----
> # updated to use information from:
> # http://catalyst.perl.org/calendar/2005/8/
> sub end : Private {
> my ($self, $c) = @_;
>
> # if we have any error(s) in the stash, automatically show the error
> # page
> if (defined $c->stash->{error}) {
> $c->stash->{template} = 'error/simple';
> }
>
> # use DefaultEnd magic
> $c->NEXT::end( $c );
^^^^^^^^^^^^^^^^^^^^^^
I'm not expert on NEXT but aren't you passing $c *twice* to
DefaultEnd's end? It could just be me not understanding, but I would
probably have done (wrongly?) :
$self->NEXT::end($c);
>
> # (re)populate the form
> $c->fillform( $c->stash->{formdata} );
> }
> ---- cut here ----
>
> Apprently the best of both worlds ...
I like it!
--
Alex.
More information about the Catalyst
mailing list