http://qs321.pair.com?node_id=909950

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

Dear Monks,
I have a web service written in Perl/CGI which I place on different servers including local where I do development.
Production ones have https certified connection for login/registration.
How can I check that https is open automatically in order to place right action URL in the login form (HTTPS://myservice.... instead of a regular one HTTP://.....)?
In other words I want to put a right $action in
<form name="query_form" action=$action method="POST"