[Catalyst] Re: Redispatching actions

Bernhard Graf catalyst2 at augensalat.de
Sun May 20 19:55:47 GMT 2007


A. Pagaltzis wrote:

> * Matt S Trout <dbix-class at trout.me.uk> [2007-05-20 15:55]:
> > I worked on some Maypole apps a few years back that -didn't-
> > redirect and behaved the way you're looking at implementing and
> > the "wrong URL" problem turned out to be a usability nightmare

sub update : Local {
  my ($self, $c) = @_;
  $c->detach('view') unless $c->request->method eq 'POST';
  ...

> That, plus the re-submit when the user hits the Back button.

  ...
  unless ($c->validate_token) { # Catalyst::Plugin::RequestToken
    $c->stash(message => 'Deja vu!'); # optional verbosity
    $c->detach('view');
  }
  # do update here
  ...
  $c->remove_token;
  $c->forward('view');
}

> > I'd strongly, strongly recommend against it, sending a 302
> > really isn't that bad.
>
> Or 303. ;-)

No need for redirects and all the problems they impose.
-- 
Bernhard Graf



More information about the Catalyst mailing list