Re: Quick Cookie Question, with CGI.pm.
by $Bill Luebkert other posts by this author
May 16 2002 3:08AM messages near this date
view in the new Beta List Site
Re: Quick Cookie Question, with CGI.pm.
|
Re: Quick Cookie Question, with CGI.pm.
barons@[...].net wrote:
> Thank you for the reply. I tried that but I have to use the
> $query->
>
> print $query->redirect (-uri => 'http"//localhost/test/',
> -cookie => [$send_it]);
>
> I don't print a header any where else in my script and I
> get the error.
>
> Status: 302 Moved
> Set-Cookie: test=test%3Dok%26test2%3Dtest2ok; path=/;
> expires=Thu, 16-May-2002 01:45:06 GMT
> Date: Thu, 16 May 2002 01:40:06 GMT
> location: http://localhost/test/
What's wrong with that ? Looks fine to me. What error are you talking about ?
I assume you're running on some funky M$ server like IIS/PWS ? What you
printed out above is normally eaten by the browser before it redirects to
the location. Are you somehow seeing it in the browser or what ?
Full test script (tested on Win98SE/Apache 1.3.22):
use strict;
use CGI qw(:standard);
use CGI::Cookie;
my $cookie_name = 'CookieName';
my $cookie_value = 'CookieValue';
my $cookie = new CGI::Cookie(-name => $cookie_name,
-value => $cookie_value, -path => '/cgi-bin', -domain => '',
-secure => '',
); # -expires => '+3d',
my $cgi = new CGI;
print $cgi-> redirect(-uri => '/cgi-bin/env.pl', -cookie => [$cookie]);
exit 0;
__END__
Sets the cookie:
HTTP_COOKIE = 'CookieName=CookieValue'
and redirects to env printing script.
--
,-/- __ _ _ $Bill Luebkert ICQ=14439852
(_/ / ) // // DBE Collectibles Mailto:dbe@[...].com
/ ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Carl Jolley
Carl Jolley
Carl Jolley
Carl Jolley
$Bill Luebkert
$Bill Luebkert
$Bill Luebkert
$Bill Luebkert
|