Altho the implications here<div><a href="http://search.cpan.org/~bobtfish/Catalyst-Plugin-Session-0.31/lib/Catalyst/Plugin/Session.pm#METHODS">http://search.cpan.org/~bobtfish/Catalyst-Plugin-Session-0.31/lib/Catalyst/Plugin/Session.pm#METHODS</a></div>
<div>are that you can do multiple redirects with one $c-&gt;flash -- to wit:</div><br>&quot;&quot;&quot;<br>The flash data will be cleaned up only on requests on which actually use $c-&gt;flash (thus allowing multiple redirections), and the policy is to delete all the keys which haven&#39;t changed since the flash data was loaded at the end of every request.<br>
&quot;&quot;&quot;<br><div><br></div><div>We just treat it as a preloaded stash, and that seems to work fine for us. If we want a more permanent chunk of data, we inject it into $c-&gt;session.</div><div><br></div><div><br>
</div><div><br><div class="gmail_quote">On Sun, Jan 23, 2011 at 11:36 PM, will trillich <span dir="ltr">&lt;<a href="mailto:will.trillich@serensoft.com">will.trillich@serensoft.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I think stash is the ephemeral one-shot hashref, whereas flash is the next-request&#39;s preloaded stash. That is, you can load up your flash with whatever you need, and then do a full $c-&gt;res-&gt;redirect() somewhere -- which fires off a browser redirect and a new request -- and your then-stash will have all the goodies you plopped in there.<div>

<br></div><div>And, being the stash, it&#39;s all wiped out when the request is done. So a follow-up request (or redirect) would either have an empty stash, or it&#39;d require the second request-handling routines to stuff things into flash (again).</div>

<div><br></div><div>So it&#39;s not that &quot;flash&quot; is permanent, it&#39;s not. It&#39;s just a pre-load for the next-request&#39;s short-lived stash.</div><div><div></div><div class="h5"><div><br><br><div class="gmail_quote">
On Sun, Jan 23, 2011 at 10:58 PM, Eric Berg <span dir="ltr">&lt;<a href="mailto:eberg@bergbrains.com" target="_blank">eberg@bergbrains.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div bgcolor="#ffffff" text="#000000">
    Thanks, Will.  That I figured that would work, but I thought that
    the flash was the right way to do it -- especially with the
    automatic cleanup, so I was holding off on trying that.<br>
    <br>
    Why doesn&#39;t flash work across these multiple requests?  I thought
    that was the whole idea of flash vs. stash.<br><font color="#888888">
    <br>
    Eric</font><div><div></div><div><br>
    <br>
    On 1/23/11 11:52 PM, will trillich wrote:
    <blockquote type="cite">
      <div>The flash is moved to the stash after the redirect, and then
        it&#39;s gone after that, right?</div>
      <div><br>
      </div>
      What we do is stuff the intended destination into the session and
      then pull it from there:
      <div><br>
      </div>
      <div>
        <div>sub login : Chained(&#39;/&#39;) PathPart(&#39;login&#39;) Args(0) {</div>
        <div>    my ( $self, $c ) = @_;</div>
        <div><br>
        </div>
        <div>    my $form = Spill::Form::Login-&gt;new( action =&gt;
          $c-&gt;uri_for(&#39;/login&#39;) );</div>
        <div><br>
        </div>
        <div>    $c-&gt;stash(</div>
        <div>        template =&gt; &#39;login.tt2&#39;,</div>
        <div>        form     =&gt; $form,</div>
        <div>    );</div>
        <div><br>
        </div>
        <div>    if ( $c-&gt;action ne &#39;login&#39; ) {</div>
        <div>        # Stuff destination into session for later redirect
          if user authenticates</div>
        <div><b>        $c-&gt;session-&gt;{redirect} =
            $c-&gt;req-&gt;uri-&gt;as_string;</b></div>
        <div>    }</div>
        <div><br>
        </div>
        <div>...then, later, after authenticating...</div>
        <div><br>
        </div>
        <div>
          <div>            my $go = <b>delete(
              $c-&gt;session-&gt;{redirect} )</b> ||
            $c-&gt;req-&gt;headers-&gt;referer;</div>
          <div>            $go = &#39;/&#39; if $go =~ /\blog(in|out)\b/;</div>
          <div>            $c-&gt;res-&gt;redirect( $go );</div>
          <div>            $c-&gt;detach;</div>
        </div>
        <div><br>
        </div>
        <br>
        <div class="gmail_quote">On Sun, Jan 23, 2011 at 8:27 PM, Eric
          Berg <span dir="ltr">&lt;<a href="mailto:eberg@bergbrains.com" target="_blank">eberg@bergbrains.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">If a user submits a certain form without
            being logged in, I flash the current URL, save the params in
            the session, and redirect them to the login.<br>
            <br>
            In my Login controller, I look for
            $c-&gt;flash-&gt;{redirect_url} and redirect them back to
            that URL.<br>
            <br>
            The problem is that that flash entry is gone after the user
            submits the login form.  I logged out the redirect URL at
            the beginning of my login routine and it comes through the
            first time, but even if I don&#39;t access it via the log
            statement, that redirect_url key is not there in the flash
            when the user submits the login form with their credentials.<br>
            <br>
            I&#39;ve tried resetting $c-&gt;flash-&gt;{redirect_url} in the
            login routine and also tried $c-&gt;keep_flash( qw(
            redirect_url )) in the login routine, but no go.<br>
            <br>
            Any thoughts on what I might be doing wrong?<br>
            <br>
            Eric<br>
            <br>
            _______________________________________________<br>
            List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
            Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
            Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
            Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        The first step towards getting somewhere is to decide that you
        are not going to stay where you are.  -- J.P.Morgan<br>
      </div>
      <pre><fieldset></fieldset>
_______________________________________________
List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a>
Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>The first step towards getting somewhere is to decide that you are not going to stay where you are.  -- J.P.Morgan<br>
</div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>The first step towards getting somewhere is to decide that you are not going to stay where you are.  -- J.P.Morgan<br>
</div>