On my box, that code also fails, differently. It sends the cookies, but then prints the HTTP 302 code to the browser, rather than redirecting, like so:
Status: 302 Found Location: http://localhost
However, monkeying around with your code, I made this slight adjustment (look closely to see the difference!):
print $q->header( -cookie => [ $set_session, $set_username ],
print $q->redirect('http://localhost/'));
... and lo! my script works again! :D
That's right, on my box, I will now have to insert a superfluous print in all of my cgi scripts that happen to send a redirect in the html header. How bizarre. But thanks to the both of you for the help!
FYI, I experienced this behaviour with both whatever version of CGI.pm came with Lucid (didn't check), and then with the latest from git, 3.59 I guess. |