kiat has asked for the wisdom of the Perl Monks concerning the following question:
Is CGI::Session supposed to do what is typically done by cookies? It seems cookies don't work when firewalls are installed or in certain OSs
I once set a cookie (with use CGI qw(:standard)) with an expiry value of '+h'. While that worked in Windows 98 and XP (and I suspect most other OSs, it ran into problems in Windows 2000 Professional.) The cookie could not be set. I played with the values and changed it to '+3H', and that solved the problem. The cookie code is as follows:
Anyway, cookies come across as pretty unreliable to me (besides the fact that their values can be modified) so I'm wondering if using CGI::Session is a better solution to managing persistent sessions...package Login; use Subs; my $cookie1 = do_cookie( -name => 'cookie1', -value => '123', -path => '/', -expires => '+h' ); my $cookie2 = do_cookie( -name => 'cookie2', -value => 'abc', -path => '/', -expires => '+h' ); main_page({ cookie => [$cookie1, $cookie2] }); 1; package Subs; use CGI qw(:standard); sub do_cookie { my %cookie = @_; return cookie(%cookie); } sub main_page { my $stuff = shift; print header(-cookie => $stuff->{'cookie'}); # rest of code... } 1;
Any opionions? cheers,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI session vs cookie
by matija (Priest) on Apr 13, 2004 at 05:55 UTC | |
|
Re: CGI session vs cookie
by eric256 (Parson) on Apr 13, 2004 at 16:00 UTC |