in reply to Re: CGI::cookie query
in thread CGI::cookie query

THis seems like the best idea!!! I have tried it however with no success. What did you actually mean by 'may have to use a reference to @cookies' Does anybody know if it is possible to writea cookie with an array $query->header(-cookie=>@cookies);

Replies are listed 'Best First'.
Re: Re: Re: CGI::cookie query
by Masem (Monsignor) on Apr 02, 2001 at 21:16 UTC
    Use $query->header( -cookie=> \@cookies ); (note the '\', that makes the call use a reference to @cookies as opposed to the variable @cookies itself), instead of what I had initially. Again, it's untested, so it might not work, though I doubt that it won't work this way.
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      Strange, it still only prints out the last instance. Can you think of anything else, Im pulling my hair out on this end!! THanks
      Just to show you the code. $inputs is a hash
      sub set_cookie_value { my ($inputs) = @_; $query = new CGI(); my $cookie = ""; my @cookies = (); my $key; foreach $key (keys %$inputs) { $cookie = new CGI::Cookie(-name=>$key, -value=>$inputs->{$key} +, -expires=>$inputs->{$key}, -path=>'/', -domain=>'', -secure=>0); push (@cookies, $cookie); } print $query->header( -cookie=> \@cookies ); }