nop has asked for the wisdom of the Perl Monks concerning the following question:

I have a CGI script that has been working fine for several months on an intranet (ActiveState, NT). After upgrading perl to 5.6, the script no longer works... the problem is that I think cookies are not getting set properly. As I didn't change any code, I suspect the problem rests with the new perl or the new CGI module... Anyone have any suggestions on this?

code snippet:
my $user = $q->remote_user; my $password = "password"; # doesn't matter if ($user ne "" and $password ne "") { my $access = &authorize($user,$password); my $c_a = $q->cookie(-name=>'access', -value=>$access, -expires=>$expires); my $c_u = $q->cookie(-name=>'user', -value=>$user, -expires=>$expires); print $q->header(-cookie=>[$c_a, $c_u]) . $q->start_html(-title=>"R3: login", -style=>{-code=>&css()}) . "<h1>Welcome to R3!</h1><h2>Hello, $user.<h2><h3>You have access l +evel $access and are logged in for $expires.<br>Have a nice day.</h3> +" . $q->end_html; exit(0);

Replies are listed 'Best First'.
Re: cgi cookie failure
by Fastolfe (Vicar) on Oct 04, 2000 at 23:02 UTC
    Please elaborate on how the script "no longer works." Are you getting an error message? Are the cookies simply not making their way to the browser? You can test the latter by setting your cookie settings to "prompt" in your browser, which should give you details on what the script is attempting to set. If you haven't narrowed down the nature of the problem, perhaps you should put in some debugging code to echo out some of your variables there and see where the problem manifests itself.
Re: cgi cookie failure
by isotope (Deacon) on Oct 05, 2000 at 02:51 UTC
    Try running the CGI script on the commandline, which will let you use CGI.pm's interactive mode. Examine the headers it returns to see if the cookie is being generated.

    --isotope
Re: cgi cookie failure
by wardk (Deacon) on Oct 05, 2000 at 00:47 UTC
    Is the $expires variable being set? (it's not in the supplied snippet).
RE: cgi cookie failure
by nop (Hermit) on Oct 05, 2000 at 01:06 UTC
    Yes, expires is set.
    Yes, I've set "prompt when setting cookies" (in IE) and I am not being prompted... it is as if CGI.pm isn't writing the cookie...?