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

I'd like to write an SSI (in perl of course...) that checks to see what page executed it and do stuff based on the URL. Is there a way I can get the URL (in a variable) to the SSI?

Replies are listed 'Best First'.
Re: Get URL path from SSI?
by btrott (Parson) on Mar 31, 2000 at 23:48 UTC
    I believe there's an environment variable that should hold that information (or, at least, the path to the file that's executing the SSI). Do a dump of %ENV in your SSI to check:
    print "Content-Type: text/html\n\n"; for my $k (keys %ENV) { print $k, " = ", $ENV{$k}, "\n"; }
    I know that such a variable exists; I just don't remember its name (I also remember that there is/was a bug with Netscape Enterprise where the variable doesn't get set-- it worked on Apache, though.)
Re: Get URL path from SSI?
by chromatic (Archbishop) on Apr 01, 2000 at 01:07 UTC
    Isn't it DOCUMENT_URI? PATH_INFO might work, too.
    my $uri = $ENV{DOCUMENT_URI}; # do something
RE: Get URL path from SSI?
by jerf (Initiate) on Apr 02, 2000 at 02:35 UTC
    Thanks alot guys! It was SCRIPT_NAME that I turned out needing. Thanks again for your help :)