Jump to content

[SOLVED] Perl Environment Variables Question


Recommended Posts

Hello -

 

I am currently working on a very simple script in perl.  Here is the code:

 

#!/perl/bin/perl.exe
use String::Random qw(random_regex random_string);
open FILE, "+>", "$ENV{'REMOTE_USER'}.INI" or die $!;
print FILE str;
print FILE "
str4";
print FILE 
random_regex('\d\d\d');
close FILE;
print <<HTML;
Content-type: text/html

<html><head><title>Success</title></head><body bgcolor=white>
<h1>User Created</h1>

HTML

 

The script runs fine, but gets tripped up at $ENV{'REMOTE_USER'}.  It creates a file with a blank name (ie .ini) instead of admin.ini, which is the user that is logged in when I run the script.  Any ideas as to why it is not displaying the remote user in the file name?

Link to comment
Share on other sites

Upon further analysis of the problem I discovered that perl is having problems just called the remote_user variable.  I got this script from the apache documentation to test it:

 

#!/perl/bin/perl.exe

my $REMOTE_USER = $ENV{'REMOTE_USER'};

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

print "The authenticated user is $REMOTE_USER\n";

 

No luck printing the remote_user!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.