Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Serializing Cookies ???

by steveAZ98 (Monk)
on Dec 06, 2000 at 03:04 UTC ( #45117=note: print w/replies, xml ) Need Help??


in reply to Serializing Cookies ???

This code seems to work for me if I change from nfreeze to freeze as in the code below. I'm not sure what your error means, I was unable to duplicate it. Here are two scripts that I put together to test these routines.
HTH
#!/usr/bin/perl -w use CGI; use Storable qw(freeze); my $q = CGI->new(); sub make_cookie { $q->cookie( -name=>'Test', -value=>unpack("H*",freeze(['1245','foo','foopass'])), -path=>'/' ); } print $q->header(-cookie=>make_cookie()); print $q->start_html(-title=>'Test cookie'); print "Cookie Set<br>"; print $q->end_html;
and this to retrieve the cookie.
#!/usr/bin/perl -w use CGI; use Storable qw(thaw); my $q = CGI->new(); sub see_cookie { @{ thaw( pack("H*",$_[0]) ) }; } print $q->header(); print $q->start_html(-title=>'Test cookie'); print "Cookie Value: ", (join " -- ", see_cookie($q->cookie('Test')) ) +, "<br>"; print $q->end_html;
Update:
I tried these scripts under mod_perl also and they work in that enviorment also (Apache::Registry), I would take a look at your Storable module.

Replies are listed 'Best First'.
Re: Re: Serializing Cookies ???
by lindex (Friar) on Dec 06, 2000 at 03:11 UTC
    Hmm maybe its the install of Storable on my machine, or maybe mod_perl has issues with Storable or vice versa?


    lindex
    /****************************/ jason@gost.net, wh@ckz.org http://jason.gost.net /*****************************/

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://45117]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2018-08-19 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (187 votes). Check out past polls.

    Notices?