TechDex Development & Solutions
live minder, lead generation, trend analysis, market research, internet marketing, seo, social media, keyword analysis


RSS Feed| Blog Home | Log In | View As Guest  | Archives |

Blog Search

How to get the current URL in Perl

How to get the current URL in Perl
Posted by Dexter Nelson: Monday, February 3, 2014 (4:40 PM)

How do you get the current url in perl?


Well? I didn't want to use LWP or CGI or any of that, and environment variables don't give you the full URL, so here is the solution I came up with to get the current url in perl.


## CODE SNIPPET ##


my $page_url = 'http';
if ($ENV{HTTPS} = "on") {
$page_url .= "s";
}
$page_url .= "://";
if ($ENV{SERVER_PORT} != "80") {
$page_url .= $ENV{SERVER_NAME}.":".$ENV{SERVER_PORT}.$ENV{REQUEST_URI};
} else {
$page_url .= $ENV{SERVER_NAME}.$ENV{REQUEST_URI};
}

## END CODE SNIPPET ##


Thanks to some creative concatenation, I can use the $page_url variable whenever I need to get the current url of the page in perl.


Leave a comment below and let me know if this worked for you as well.


By the way...


Are you interested in learning how I make extra money blogging? (I use the money to pay for licenses and stuff so I don't have to come out of pocket)


What would you do with it?

Admin
User: Admin 
Member Since: 1/1/2009 
Number of Posts: 145 
Message Admin
--
Dexter Nelson
TechDex Development & Solutions
http://www.techdex.net

Facebook: http://www.facebook.com/dexter.nelson
Twitter: http://twitter.com/dexterwebn

Leave A Reply


Post A Comment


Most Commented Stories
  1. Windows Media Player Crashes Playing MP4 Files (Solved) (662)
  2. Saggy Pants Cost Green Day Singer His Plane Seat (183)
  3. Ounce By Ounce Gold Takes Off (166)
  4. Occupy Protesters Rally Around Wounded Iraq Vet (82)
  5. SOLVED EXE Files Wont Run Cant Run EXE Files (30)
  6. TechDex SMART Mobile Design (21)
  7. Live Minder Case Study 1 (18)
  8. TechDex DirectToDesktop direct2client technology (16)
  9. Updated How To Get Indexed in Yahoo (14)
  10. Live Minder Trend Analysis Statistics Day 4 (13)

Top 10 Stories
  1. SOLVED - Cortana Location Services Can't Turn On Greyed Out
  2. SOLVED Missing High Performance and Power Saver Plans in Power Options in Windows 10
  3. How to Increase the WordPress Maximum Upload File Size
  4. Apple Claims Their New iPad Pro Will Replace The Laptop
  5. Secunia PSI 3.0 Stuck on Determining Which Files to Scan SOLVED
  6. How To Successfully Remove Rombertik Malware
  7. Using Dark Post Profits 2.0 To Increase Software Sales
  8. Best Free Ad Blocking Software Review
  9. Free Commercial Real Estate Service And Real Estate Script
  10. Are Earthquakes Causing Global Climate Change




® Live Minder © TechDex Development & Solutions.
live minder, lead generation, trend analysis, market research, internet marketing, seo, social media, keyword analysis

Powered by TechDex CGI Blog.