Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to store a complex data structure such as a hash or array reference in a Dancer session? like
use Dancer2; setting( session => 'PSGI' ); get '/' => sub { my $struct = session("struct"); session "struct" => [1,2,3]; return "This is my " . $@struct; };

Replies are listed 'Best First'.
Re: Dancer Session
by Corion (Patriarch) on Jan 16, 2015 at 13:06 UTC

    That depends on your chosen session backend. Some session backends seem to suggest that they support structured data like hashes or arrays. Personally, I would try to avoid them.

Re: Dancer Session
by Anonymous Monk on Jan 17, 2015 at 00:08 UTC
    What happens when you tried?
      Well, I tried

      After fixing the typos, and trying it without  session: PSGI I've come to realize Dancer2::Session::PSGI is broken, it doesn't work

      The default Dancer2::Session::Simple allows "structs"

        Dancer2::Session::Cookie can point to structures like session('mynumbers') =>$array_ref