[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Accessing the HTTP_REFERER



Hello, 

I have an account on a UNIX box running Apache 1.2x.

I want to pass  the value of the  HTTP_REFERER variable from a xSSI (server-side include) to a perl script in my cgi-bin directory.

So for example, in "myPage.html" I have the following:

# <!--#include virtual="/home/myAccount/public_html/cgi-bin/perlScript.pl" --> 

In perlScript, I  have tried the following tests with no success. 

#!/local/bin/perl5 -w

use CGI qw(:standard);

$url1 = ${HTTP_REFERER}; #shell way
$url2 = $ENV{'HTTP_REFERER'}; # perl way
$url3 = referer(); # CGI.pm way

print "Content-type: text/html\n\n";

print "$url1\n";    # not working / empty
print "$url2\n";    # not working / empty
print "$url3\n";    #not working / empty

$text = h1('But CGI.pm does work !\n');
print "$text\n";    # working

NOTE: This script is a test, and I don't want to "print"  in myPage.html the HTTP_REFERER, I just want to check if Perl is accessing this variable.

What I'm trying to do is to get the name "myPage.html" when its asked by a user, ask perl to look in a DBM file for the key "myPage.html", if its  not there, create this key and give "1" for value. If the key exists, increment its value by 1.  

So my question is this one. 
Is it possible to  trigger from xSSi a perl script which is going to access all the environnement variables? 

>From my tests, it seems that these variables or out of scope for a perl script triggered like this. So I guess, my only alternative is to use a CGI and find a simple way to trigger the perl script without the user knowing it.


Thanks.

BTW, thanks for answering my previous post.

Cheers

-Emmanuel
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Emmanuel M. Dˇcarie - <emm@cam.org>
---> The Frontier Newbie Toolbox:
<http://www.cam.org/~emm/frontierNewbieToolbox.html>
---> Frontier en fran¨ais ! 
<http://www.scripting.com/frontier5/francais/>
<http://www.scriptmeridian.org/tutorials/francais/odb/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch