Re: Authentication logic [was: Changing browser URL based on condition]

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC0_be2bNs6o3JWUEZc3fUWZ5e6OvRbyPyiC7T+S4qSw7tMmQw@mail.gmail.com>
On Sat, Jul 16, 2011 at 1:01 PM, Vincent Veyron <[email protected]> wrote:
> As I said, I replaced the call to tie with :
>
> $r->pnotes('session' => Storable::retrieve($session_file));
>
> where $session_file again is retrieved from the cookie.
>
> What I can't find out is : how do I store %session into a database
> without using tie??

That's what I'm trying to explain.  You can either use the Storable
API to put your session into a string, and then write to a database
using standard DBI, or you can use a pre-built tool like CGI::Session.

To serialize your session to a string, you can do something like this:
use Storable qw(nfreeze);
$serialized = nfreeze \%session;

See the Storable docs for more.

- Perrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.