in reply to CGI::Cookie issues

You can use the header method from CGI.

from the CGI docs
print $query->header(-cookie=>$cookie);

This will not prevent it from printing to the screen when run as a command line program - since CGI uses STDOUT for it's content. You could disable from the command line by checking the $query->request_method() a command line invocation should IIRC not return anything



grep
Mynd you, mønk bites Kan be pretti nasti...

Replies are listed 'Best First'.
Re: Re: CGI::Cookie issues
by sdyates (Scribe) on Nov 21, 2002 at 03:36 UTC

    Thanks... That hides the header... which is good! However, I still cannot get the ReadCookie() method to read the cookie... or more correctly, I cannot get the cookie set properly.

    #!/usr/local/bin/perl use CGI qw/:standard/; use CGI::Cookie; $passwd="toronto5"; $cookie1 = new CGI::Cookie(-name=>'DB', -value=>{ username => simony, password => toronto5, }, -expires => '+8H'); #print header(-cookie=>[$cookie1]); print "Set-Cookie: $cookie1\n"; print "Content-Type: text/html\n\n"; print $cookie1;

    The above has no problem setting the cookie if it stands alone. I don't want to be a code mooch, but finding documentation that is correct is not easy--even the man pages are not consistant. Can you provide any direction in this manner?

    Thanks, Simon