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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
$ENV ?

 



mike robb
Deleted

May 6, 2000, 9:22 AM

Post #1 of 3 (2453 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:

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

use logaccess;
logaccess::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?



tallest1
Deleted

May 7, 2000, 9:14 AM

Post #2 of 3 (2453 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
Deleted

May 7, 2000, 9:38 AM

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

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

--mike

 
 


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

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