[Catalyst] Re: Redispatching actions

A. Pagaltzis pagaltzis at gmx.de
Mon May 21 06:25:05 GMT 2007


* Bernhard Graf <catalyst2 at augensalat.de> [2007-05-20 21:05]:
> A. Pagaltzis wrote:
> > 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');
>   }

So loading an extra plugin and sprinkling guards all over your
code is preferrable to you over simply issuing a redirect. Not
only that, but your choice causes the following sequence of
events:

    User: *hits Back button*
    Computer: This page has POSTDATA. Resubmit it?
    User: (thinks) What the?! Hmm… err…
    User: *hits OK*
    Computer: Ack! You tried to resubmit a form! No cookie!
    User: @#$&!!

Compare to the alternative, where successful submit produces a
redirect:

    User: *hits Back button*
    Computer: *goes back a page*

Guess which one will annoy users less.

You said absolutely nothing to address the “wrong URL” problem
Matt mentioned, btw.

Of course, you can spend your days writing code to fight the way
HTTP works. It’s up to you to judge whether that is a worthwhile
use of your time. But I do think you’d be happier and your code
simpler and more robust if it didn’t try to cut against the web’s
grain.

> No need for redirects and all the problems they impose.

Can you explain one the problems, please?

Redirects are one of the greatest features of HTTP, actually.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list