http://www.perlmonks.org?node_id=11108067


in reply to Perl v5 CGI error Use of uninitialized value $session_status

I didn't actually run the code, but a quick review shows some suspicious lines:

### Grab SID and determine session_status my $sid = $session->id(); my $session_status = "false"; $session_status = $session->param("user_logged_in");

So, if the session does not contain a paraneter user_logged_in, you are overwriting the value "false" with undef.

Maybe what you want is this:
### Grab SID and determine session_status my $sid = $session->id(); my $session_status = $session->param("user_logged_in") // "false";

Later in the code (though not at line 89) you do the comparison which triggers the warning:

if ($session_status eq 'true')

Most probably that warning also causes the IIS to complain. IIS is expecting your response to start with a header, but gets a timestamp from the warning instead. The timestamp, starting with a [ character, is what you get from using CGI::Carp.

That said, I guess you are aware that this program looks more like 20th-century legacy than current best practice for a web application. We love Perl just because it is so simple to whip something up which will run for decades without a change, but still... given that the internet is no longer the same friendly place which it was 20 years ago, a bit of general refurbishment wouln't hurt.

Replies are listed 'Best First'.
Re^2: Perl v5 CGI error Use of uninitialized value $session_status
by RedJeep (Sexton) on Oct 29, 2019 at 22:38 UTC
    Your fix... my $session_status = $session->param("user_logged_in") // "false"; Seems to be working. If the site proves even moderately successful then I will look at one of the Perl or Python web frameworks. I only have about 20 pages so didn't want to invest much extra effort.

    Thanks for your help!