Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to force Perl to read $ENV{'HTTP_COOKIE'} values again?

Status
Not open for further replies.

ttest

Programmer
Jun 28, 2000
38
US
I have a line in the beginning of my script to set some cookie using HTTP header.

Somewhere in my script, I have to read the value of $ENV{'HTTP_COOKIE'}. But $ENV{'HTTP_COOKIE'} does not contain the value I set using the HTTP header. Is there a way to force Perl to refresh the value of $ENV{'HTTP_COOKIE'} (ask it to retrieve cookies from browser again).
 
good question! ] always a sucker to the greatest lie of all: will only take a minute [
 
Hmmmm.

This will only be available to a new instance of Perl. What about another Perl script which prints the value of an environment variable? Something like this:

$env_var = shift;
print $ENV{$env_var}, "\n";

This could then be called in your main Perl script like this:

chomp($ENV{'HTTP_COOKIE'} = `get_env.pl 'HTTP_COOKIE'`);

Where get_env.pl is the two line script above. Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top