CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
$ENV ?


mike robb

May 6, 2000, 9:22 AM

Post #1 of 3 (4454 views)
$ENV ? Can't Post

  $doc = $ENV{'DOCUMENT_URI'} if (defined $ENV{'DOCUMENT_URI'});
$from = $ENV{'HTTP_REFERER'} if (defined $ENV{'HTTP_REFERER'});

I use these 2 statements in a Perl CGI program. They both pick up the current document and the referrer page, but only when the CGI program is run from a SSI call inside an HTML document.

If I run this perl program from a CGI program that is directly accessed by the user. (ie http:://www.../cgi/perl.cgi) and have that perl.cgi file actually does this:

unshift(@INC, "/actual-path/cgi-local/tracker");

use logaccess;

this actually runs that routine, and does other stuff... but it just doesn't ever pick up the referrer or the current page.

(logaccess() is a sub routine which actually does the $ENV calls... and it does pick up other env variables.. .just not these 2)

any ideas?


May 7, 2000, 9:14 AM

Post #2 of 3 (4454 views)
Re: $ENV ? [In reply to] Can't Post

If someone simply typed the scripts URL into their browser, there would be no referer. Otherwise, from my experience, it should work. I'm positive that after submitting a form to a script, the script's http_referer variable would give the URL to the form. Try creating an HTML document that links to the script, clicking on the link, and seeing what happens.

As for 'Document_URL', if you are trying to get the URL of the script, use $ENV{'SCRIPT_NAME'}

mike robb

May 7, 2000, 9:38 AM

Post #3 of 3 (4454 views)
Re: $ENV ? [In reply to] Can't Post

i'll have to go check it out...



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives