Cookies and Handlers

2001-08-08 Thread Rasoul Hajikhani

Why is setting cookies so complex in mod_perl...
Can any one tell me how I can set a few cookies in one handler and hand
over the operation to another handler to do some more stuff... 
I have tried everything that I know (that's not much) but I still can
not set the cookies...
here is the snippet of my cookie setter handler:
 my $u   = Apache::Cookie-new( $r,
  
-name   = 'randh_webuname',
  
-value  = $webuname,
  
-domain = '.rhythm.com',
  
-expires= '+24H',
  
-path   = '/'
 );
$r-err_headers_out-add('Set-Cookie' = $u) if $u;

some more cookies here

$r-err_headers_out;
return DECLINED; # tried OK with the same result
}
1;

At this point my second handler takes over ...
.
.
.

$r-err_headers_out;
return OK;

Please Help :(
-r



Re: Cookies and Handlers

2001-08-08 Thread Tim Tompkins

Time abbreviations are case sensitive:

=pod

 The following forms are all valid for the -expires field:
+30s  30 seconds from now
+10m  ten minutes from now
+1h   one hour from now
-1d   yesterday (i.e. ASAP!)
now   immediately
+3M   in three months
+10y  in ten years time

=cut

So, change +24H to +24h.

Note that you may also, $u-bake() since you're using Apache::Cookie.  This
will set the outgoing headers for you.


Regards,
Tim Tompkins
--
Programmer
http://www.arttoday.com/
http://www.rebelartist.com/
--


- Original Message -
From: Rasoul Hajikhani [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 08, 2001 6:11 PM
Subject: Cookies and Handlers


 Why is setting cookies so complex in mod_perl...
 Can any one tell me how I can set a few cookies in one handler and hand
 over the operation to another handler to do some more stuff...
 I have tried everything that I know (that's not much) but I still can
 not set the cookies...
 here is the snippet of my cookie setter handler:
  my $u   = Apache::Cookie-new( $r,

 -name   = 'randh_webuname',

 -value  = $webuname,

 -domain = '.rhythm.com',

 -expires= '+24H',

 -path   = '/'
  );
 $r-err_headers_out-add('Set-Cookie' = $u) if $u;

 some more cookies here

 $r-err_headers_out;
 return DECLINED; # tried OK with the same result
 }
 1;

 At this point my second handler takes over ...
 .
 .
 .

 $r-err_headers_out;
 return OK;

 Please Help :(
 -r