code_junkie

What's the best action persistence technique for a Catalyst application?

Nov 13th, 2011
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. use Storable;
  2. ...
  3. sub auto {
  4. ...
  5. unless (...) { #ie don't do this if processing the login action
  6. my $formitems = freeze $c->request->body_parameters;
  7. my $freezer = $rs->update_or_create(
  8. {user => $c->user, formitems => $formitems} );
  9. # Don't quote me on the exact syntax, I don't use DBIx::Class
  10. }
  11. ...
  12. my $formitems = $c->request->body_parameters
  13. || thaw $rs->find({$user => $c->user})->formitems
  14. || {} ;
  15. # use formitems instead of $c->request->body_parameters from here on in
Add Comment
Please, Sign In to add comment