Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Request URI

by Anonymous Monk
on Feb 11, 2007 at 04:24 UTC ( #599423=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I'm on Windows running IIS using Active State Perl

Since I'm not on apache, does this mean I can't use certain environmental variables?

I'm trying to receive the url the end user is currently requestion, so a little snippet of my code that prints nothing:
my $url = $ENV{REQUEST_URI}; print "$url"; #prints nada!

Ty

Comment on Request URI
Download Code
Re: Request URI
by Joost (Canon) on Feb 11, 2007 at 04:30 UTC
      I have seen a few tutorials on Environment Variables in Perl that show REQUEST_URI as a perl Environment Variable.
      They dont say anything about apache providing it and IIS not.

      I'm not saying Joost is wrong, but there may be some tutorials out there that are.

Re: Request URI
by Khen1950fx (Canon) on Feb 11, 2007 at 14:48 UTC
    Try this:

    my $url = $ENV{'REQUEST_URI'}; print "$url";

    Update: Oops.. I'm sorry, I was thinking in terms of Linux. Maybe Win32::Env could help.

Re: Request URI
by EvanK (Chaplain) on Feb 12, 2007 at 16:23 UTC
    As Joost suggested, you may have to build it from other environment vars. To get a list of all the environment vars your install of IIS provides to perl, you could dump the %ENV hash to a file like so:
    #!c:/perl/bin/perl -w use strict; use Data::Dumper; open my $ENV_DUMP, '>', 'c:/iis_env.txt' or die $!; print {$ENV_DUMP} Dumper(\%ENV); close $ENV_DUMP; print "Content-Type: text/plain\n\nSuccess!";
    Of course, you want to run this through IIS, not the Windows command line.

    __________
    Systems development is like banging your head against a wall...
    It's usually very painful, but if you're persistent, you'll get through it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://599423]
Approved by Joost
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2014-12-22 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls