[Dancer-users] Code refactoring gotchas?

David Precious davidp at preshweb.co.uk
Fri Sep 10 14:12:26 CEST 2010


On Friday 10 September 2010 10:27:34 Flavio Poletti wrote:
> I sometimes am in the need of refactoring code that should be shared
> between different routes. As an example, I could have a POST route
> '/do-operation' that has to perform some operations and then generate a
> page exactly as if a GET route '/default' had been called.

Personally, in that case I'd be inclined to redirect to /default after 
performing the appropriate operations; this also has the benefit of meaning 
that if a user hits refresh, they're not prompted to re-submit the POST 
request, and avoids any problems that them blindly clicking OK and re-
submitting it could cause.


-- 
David Precious <davidp at preshweb.co.uk>
http://blog.preshweb.co.uk/    www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/identica    www.lyricsbadger.co.uk

  "Programming is like sex. One mistake and you have to support 
  it for the rest of your life". (Michael Sinz)


More information about the Dancer-users mailing list