J
Jason Carlton
For CGI::Cookie, Cpan states:
The simplest way to send a cookie to the browser is by calling the bake
() method:
$c->bake;
If you want to set the cookie yourself, Within a CGI script you can
send a cookie to the browser by creating one or more Set-Cookie:
fields in the HTTP header. Here is a typical sequence:
my $c = new CGI::Cookie(-name => 'foo',
-value => ['bar','baz'],
-expires => '+3M');
print "Set-Cookie: $c\n";
print "Content-Type: text/html\n\n";
When should I use "bake", and when should I simply use "Set-Cookie"?
Is there an advantage or disadvantage either way?
The script I'm building doesn't actually print anything to the screen,
but just redirects to a success page. Since there's no content-type
being printed, does this mean that I need to use bake?
TIA,
Jason
The simplest way to send a cookie to the browser is by calling the bake
() method:
$c->bake;
If you want to set the cookie yourself, Within a CGI script you can
send a cookie to the browser by creating one or more Set-Cookie:
fields in the HTTP header. Here is a typical sequence:
my $c = new CGI::Cookie(-name => 'foo',
-value => ['bar','baz'],
-expires => '+3M');
print "Set-Cookie: $c\n";
print "Content-Type: text/html\n\n";
When should I use "bake", and when should I simply use "Set-Cookie"?
Is there an advantage or disadvantage either way?
The script I'm building doesn't actually print anything to the screen,
but just redirects to a success page. Since there's no content-type
being printed, does this mean that I need to use bake?
TIA,
Jason