in reply to Access to Windows Environment Variables

Huzzah!! Virtual Guinness for all

Yep, setting up the environment variable with $ENV sorted out the problem nicely. Didn't know that apache messed around with enivonment stuff.

Thanks all :-)

  • Comment on Re: Access to Windows Environment Variables

Replies are listed 'Best First'.
Re^2: Access to Windows Environment Variables
by hmerrill (Friar) on Aug 12, 2004 at 11:23 UTC
    Yup. Here's a small CGI script that I wrote - nothing special - to print out the cgi environment on Windoze XP:
    #!C:\Perl\bin use strict; ######## Start the HTML ######## print <<END_HTML; <html> <head> <title>Perl CGI Environment Variables</title> <STYLE type="text/css"> <!-- H1.page_title {text-align: center; color: blue} --> </STYLE> </head> <body> <h1 class="page_title">Perl CGI Environment Variables</h1> <table border="1"> <tr> <th bgcolor="#99ccff">\@INC Paths</th> </tr> END_HTML ### 1st print out the @INC array ### my $ct = 0; foreach my $dir (@INC) { print <<END_HTML; <tr> <td><b>$dir</b></td> </tr> END_HTML $ct++; } ######## Finish the @INC HTML ######### print <<END_HTML; </table> <br> <br> <table border="1"> <tr> <th bgcolor="#99ccff">Env Variable Name</th> <th bgcolor="#99ccff">Value</th> </tr> END_HTML ### Next print out all the environment variables ### foreach my $name (sort keys %ENV) { print <<END_HTML; <tr> <td><b>$name</b></td> <td>$ENV{$name}</td> </tr> END_HTML } ######## Finish the HTML ######### print <<END_HTML; </table> </body> </html> END_HTML
    Put this in your webserver's document root. I called it "env.pl", so access it by:
    http://your.server.com/env.pl
    and see what environment variables it displays.

    HTH.