in reply to Storing a Hash inside a CGI::Session Param?

The correct syntax is this:

$session->param("access", \%access);

Please read the tutorial for more.

Replies are listed 'Best First'.
Re^2: Storying a Hash inside a CGI::Session Param?
by Stenyj (Beadle) on Jul 04, 2004 at 02:16 UTC
    Forgive me for asking, but where can I find the tutorial on it?

      You know how to use perldoc, right? Just run perldoc CGI::Session::Tutorial on the command line.

      This particular information is in the section headed STORING DATA IN THE SESSION.

      HTH HAND.

        The only thing I've found in the docs, under that section, is dereferencing a reference to an array. I've tried doing something similar to dereference the hash, but not getting much luck with it.

        The param is returning the contents of the hash, but not acting like it once it's retrieved.

        my $access = $session->param("access"); where the contents of the param 'access' is a hash containing a hash. The contents are correct, when using Data::Dumper, but it's not treating it like a hash. Seems more to be treating it like a string.

        print Dumper($access);
        returns:
        $VAR1 = { 'main' => { 'access' => 1 }, 'server1' => { '1' => { 'siteName1' => 12 }, '10' => { 'siteName2' => 12 } } };

        which is the correct structure of the hash (and hashes within it, etc.)


        Stenyj