Here's my code:
#!/usr/bin/perl -w
use CGI ':standard';
if (param('code') eq 'booboo' ) {
print "Set-Cookie: 'name'='booboo'; path='\'; domain='example.com'; expires='+365d';\n";
print "Location: [example.com...]
}
else { print"Location: [example.com...] }
While I'm at it, I'm a little hazy on loading CGI modules. Some sample code tells me to do <use CGI ':standard';> while another says <use CGI qw(:cgi);> and yet another says <use CGI.pm>. Can I just call all of them (one on each line), or do they interfere with each other?
Thankie-doodle, -MBJ-
While I'm at it, I'm a little hazy on loading CGI modules. Some sample code tells me to do <use CGI ':standard';> while another says <use CGI qw(:cgi);> and yet another says <use CGI.pm>. Can I just call all of them (one on each line), or do they interfere with each other?
I'll ignore your harder, main question and just talk about "use CGI."
This falls under the heading "There's More Than One Way To Do It." Just one of these should be just fine. I usually just do "use CGI;" and move on. If that ever fails, just go back to whatever the script used originally.
(Bump. Can anyone help with the HTTP Headers issue?)
Also, you may need to put a "." before the domain name in the Set-Cookie string. As I recall, IE/Win can deal with it incorrectly formatted, but other browsers, like netscape, can't.
print redirect( -URL => "http://example.com/page1.html",
-COOKIE => $cookie);
The cookie gets set properly but the page doesn't redirect. Problem exists only in MacIE5, works fine in Safari and MSIE6. The pages being redirected to are different from the page that the form is on which calls the script.
Darn Mac IE!