Programming Tips - Perl CGI: is this a secure connection (ie https)

Date: 2020apr28 Language: perl Q. Perl CGI: is this a secure connection (ie https) A.
sub isSecure() { return lc($ENV{'HTTPS'}) eq 'on'; } sub getProtocol() { return isSecure() ? 'https' : 'http'; }
Example use:
if (isSecure()) { print "Secure connection\n"; } else { print "Non-secure connection\n"; }