ozzy has asked for the wisdom of the Perl Monks concerning the following question:

I am having a difficulty's reading some of the ENV variables with a cgi script.
my $red_url = $ENV{REDIRECT_URL} || " UNKNOWN "; my $referal_url = $ENV{HTTP_REFERAL} || " UNKNOWN ";

I have also tried this by putting ENV variables in quotes.
my $red_url = $ENV{'REDIRECT_URL'} || " UNKNOWN "; my $referal_url = $ENV{'HTTP_REFERAL'} || " UNKNOWN ";

Do certain ENV variables have to be enabled on APACHE inorder to read them. I have also printed all the ENV variables with a cgi script and the 2 above where not listed. I am pretty sure that there is a simple solution for this. Any insight would be appreciated.

Thank you fellow monks. -= Ozzy =-

Replies are listed 'Best First'.
Re: ENV variables....
by dws (Chancellor) on Mar 22, 2001 at 07:03 UTC
    What, pray tell, is an HTTP_REFERAL ?

    Perchance to you mean HTTP_REFERER ?

Re: ENV variables....
by dvergin (Monsignor) on Mar 22, 2001 at 06:58 UTC
    If you'd like some bare-bones info about what Apache is making available via %ENV, here's a pretty common little cgi script:
    #!/usr/bin/perl -w use strict; print "Content-type: text/html\n"; print "\n"; print "<html><head>\n"; print "<title>Environment Variables</title>\n"; print "</head>\n"; print "<body>\n"; print "<table border=1>\n"; print " <tr>\n"; print " <td><b>Environmental Variable</b></td>\n"; print " <td><b>Value</b></td>\n"; print " </tr>\n"; foreach my $key (sort keys %ENV) { print " <tr>\n"; print " <td>$key</td>\n"; print " <td>$ENV{$key}&nbsp;\n"; print " </td></tr>\n"; } print "</table>\n"; print "</body></html>\n";
Re: ENV variables....
by Adam (Vicar) on Mar 22, 2001 at 06:09 UTC
    You should really use CGI.pm for that stuff. Do a Super Search for CGI and referal url and you should find all that you want to know and more.