Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I can't help thinking that there's a fundamental flaw in mandating a 15 minute timeout in an app that routinely requires >15 minutes between actions.</p> <p>Be that as it may, I would look at over-riding the <code>Catalyst::Plugin::Session-&gt;delete_session</code> method so that any contents of <code>$c-&gt;request-&gt;body_parameters</code> are serialised and saved (presumably to the database) for later recovery. You would probably want some rudimentary check of the POST arguments to ensure they're what you're expecting.</p> <p>Similarly, <code>create_session</code> needs to take responsibility for pulling this data back out of the database and making it available to the original form action.</p> <p>It does seem like a messy situation, and I'm inclined to repeat my first sentence...</p> <p>UPDATE:</p> <p>Whether you use <code>delete_session</code> or <code>auto</code>, the paradoxical issue remains: you can't store this info in the session because the time-out event will destroy the session. You've got to store it somewhere more permanent so it survives the session re-initialization. <code>Catalyst::Plugin::Session</code> itself is using <a href="http://search.cpan.org/~ram/Storable-1.0.14/Storable.pm" rel="nofollow noreferrer">Storable</a>, and you should be able to with something along these lines:</p> <pre><code>use Storable; ... sub auto { ... unless (...) { #ie don't do this if processing the login action my $formitems = freeze $c-&gt;request-&gt;body_parameters; my $freezer = $rs-&gt;update_or_create( {user =&gt; $c-&gt;user, formitems =&gt; $formitems} ); # Don't quote me on the exact syntax, I don't use DBIx::Class } ... my $formitems = $c-&gt;request-&gt;body_parameters || thaw $rs-&gt;find({$user =&gt; $c-&gt;user})-&gt;formitems || {} ; # use formitems instead of $c-&gt;request-&gt;body_parameters from here on in </code></pre> <p>The underlying table probably has (user CHAR(x), formitems TEXT) or similar. Perhaps a timestamp so that nothing too stale gets recovered. You might also want to store the action you were processing, to be sure the retrieved form items belong to the right form. You know the issues for your app better than me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload