Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

Cookie help - using both cgi.pm and APR::Request::Cookie

cfaust-dougot

2008-05-27

Replies: Find Java Web Hosting

Author LoginPost Reply
Folks,
 
I taking over some really old code and I'm in the process of converting it over to mp2. I want to be able to use APR::Request::Cookie to create the cookie for the new things I'm doing but I need to create it exactly like CGI.pm is currently doing so the old code will continue to work until I get everthing updated.
 
I'm hoping someone knows both methods enough to tell me what I'm doing wrong.
 
The CGI.pm cookie is being created like:
$query->cookie(-name=>'name',-value=>[val1,val2,val3,val4,val5,val6,val7],-expires=>'+5y',-domain=>www.domain.com,-path=>/);
 
 
I do my cookies like:
 my $packed_cookie = APR::Request::Cookie->new($r->pool,
              name  => 'name',
              value  => $cookie_value,             
              path  => '/',
              domain => 'www.domain.com',
              expires => +5y,
              );    
 $r->err_headers_out->add('Set-Cookie' => $packed_cookie->as_string);
 
For the value I made an array
@cookie_value = ('val1','val2','val3','val4','val5',val6','val7');
 
In $packed_cookie I tried using @cookie_value directly, I tried it as an arrayref ($cookie_value), I tried it like [@cookie_value] etc and not matter what I do I can't get the old code to read it via
 
my ($val1,$val2,$val3,$val4,$val5,$val6,$val7) = $query->cookie(-name=>'name');
 
The cookie is getting set though, I can view it from within Mozilla. It just isn't being read by CGI.pm
 
Does anyone know what I'm doing wrong?
 
TIA!!
 
 
©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.