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


in reply to Re^2: How to get current URL with Query String
in thread How to get current URL with Query String

I wanted to quickly input here. I've been using this, especially where I have apps that run on both http:// and https:// In my case where I use OOP it's usually a subroutine in the main package, but this works just as well, calling the $page_url variable. Some smart concatenation, no additional modules, strictly native...
my $page_url = 'http'; if ($ENV{HTTPS} = "on") { $page_url .= "s"; } $page_url .= "://"; if ($ENV{SERVER_PORT} != "80") { $page_url .= $ENV{SERVER_NAME}.":".$ENVSERVER_PORT}.$ENV{REQUEST_U +RI}; } else { $page_url .= $ENV{SERVER_NAME}.$ENV{REQUEST_URI}; }
what do you think?