[Catalyst] Use Undo on A List Apart

Matt S Trout dbix-class at trout.me.uk
Sat Jul 28 13:05:12 GMT 2007


On Sat, Jul 28, 2007 at 01:00:14PM +0200, Matthieu Codron wrote:
> Hi,
> 
> Le 26 juil. 07 à 08:55, Bill Moseley a écrit :
> 
> >There's a recent article titled "Never Use a Warning When you Mean
> >Undo" at http://alistapart.com/articles/neveruseawarning.
> >
> >I'm wondering about the implementation.
> >
> 
> I read that too. Interesting, but from what I see undo is not so easy  
> to implement.
> 
> >One option is to create actions for every possible undo operation.
> >That would mean that each undo operation would generate a specific
> >link, including request parameters to identify the item that needed to
> >be, well, undone.
> >
> >Another possibility would be to generate the code for the undo action
> >and place it in the session so that there's just an /undo link.  /undo
> >fetches the code and evals/executes it.  The /undo link would only be
> >available for a single request after displaying the undo link.
> 
> I like more the idea of a generic undo request. This could be part of  
> a plugin providing this action and the necessary infrastructure to  
> implement the "un-doing" of the action.

I fail entirely to see why this should be a plugin rather than part of the
model you're intending to make mutations upon undoable.

> This plugin could implement a simple version of the classic Memento  
> pattern (http://en.wikipedia.org/wiki/Memento_pattern)

I'd say DBIx-Class-Audit (currently in bast trunk pending more testing)
already implements this pretty well for DBIC models - except it always saves
the appropriate information, saving you needing to call anything at all to
make the undo happen.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list