Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17



Posted on 1999-07-05
Medium Priority
Last Modified: 2012-05-04
I'm a beginner in perl, and I'm not sure if it's possible.

I want to make a link, say: .../mydownloadscript?

in other word, I want to pass the "" argument to the script, and when I processed othet things in the script (like a counter or such), I want the browser to start downloading the file.

I know that I can just use the Print "Location:\n\n" to start the download (probably) but I don't know how to get that link into the script...

Is it even possible? Thanks!
Question by:efortier
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 84

Expert Comment

ID: 1213887

Expert Comment

ID: 1213888
If you are asking how you could separate the part after the '?' from the link for the script, its easy.

When you are running this as a CGI script, the string after the '?' is already saved in the environment variable QUERY_STRING. So, all you have to do is:

print "Location: $ENV{QUERY_STRING}\n\n";

If this is not what you want, please clarify.

Accepted Solution

helver earned 300 total points
ID: 1213889
If you want the link embedded in the URL, you'll need to escape the string that represents the link in order to pull out the characters that would confuse the URL.

I know there's a URI::escape() method that does it.  And I believe there is also a CGI::escape() method that will convert a string to a char sequence usable in a URL.  This would imply that you'd be willing to generate the page that contains the link as well.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question