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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI.pm Cookie Problems

Status
Not open for further replies.

BenRussell

Programmer
Mar 12, 2001
243
US
To set my cookie Im using the following

$Information = "1" . "\|" . "2" . "\|" . "3" . "\|" . "password";

use CGI;
$query = new CGI;
$cookie = $query->cookie(-name=>"Information",
-value=>"$Information",
-expires=>"+3h",
-path=>"/");
print $query->header(-cookie=>$cookie);


However, instead of printing to the cookie the "|" it prints a "%7C" which is probably because of CGI.pm's parsing incoming data capabilities.
Is there any way for me to just use the part of CGI.pm that works with cookies? Or would that not even work?
- Ben Russell
- President of Intracor Technologies (
 
The key is what do you retrieve as the cookie value - after you set the cookie according to your code above, what does the next script retrieve as that cookie's value? Does it retrieve %7C for each pipe, or do you actually get the pipe(|)? My guess is that you get the actual pipe. CGI.pm encodes special characters with their hex equivalents that way, but it also decodes them when those variables(cookies) get read back in.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top