Sawsan Sarandah wrote: > Greetings, > > I have a small problem. When I create a cookie using cgi.pm, the > expiration date is always three hours behind the actual time. In > other words, the following code snipet: > > # Time on my local machine: 10:00 pm > # Rhat Linux server using "date" command: Fri Jul 11 21:59:44 IDT 2003 > # hwclock command: Fri 11 Jul 2003 09:59:48 PM IDT 0.611152 seconds > > $cookie = $cgi->cookie > > -name=> $cookiename, > -value=> $uname, > -expires=> "+4h", > -path=>'/' > ); > > The above code produced a cookie with an expiration time as follows: > > Expires: Fri, Jul 11 2003 22:58:33 > > Notice that the cookie expires in one hour, not in four hours (+4h). > What could possibly be the problem? Where is PERL reading the > incorrect time from?
It should say "Fri, Jul-11-2003 22:58:33 GMT", per the cookie specification http://wp.netscape.com/newsref/std/cookie_spec.html The time must be in GMT. Try this: $ perl -MCGI -le "print CGI::cookie(-name=>'foo',-value=>'foo',-expires=>'now'); print scalar gmtime)" foo=foo; path=/; expires=Fri, 11-Jul-2003 19:36:23 GMT Fri Jul 11 19:36:23 2003 The two dates should match. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]