If I write new data to a cookie and then use $ENV{'HTTP_COOKIE'} to display the cookie's content I always get the PREVIOUS cookie value, not the value I have just written.
Even if the "write cookie" and the "read and display cookie" routines are stored in separate scripts it still doesn't display the new value. I have tried using the SLEEP command for as much as 10 seconds between storing and retrieving cookie data and it doesn't solve the problem.
The only way around it is to store the data to be written in a variable (this is usually required anyway), then write the variable data to the cookie and display the VARIABLE instead of $ENV{'HTTP_COOKIE'}. This ensures the current value is displayed, but this method is not always convenient.
Even if the "write cookie" and the "read and display cookie" routines are stored in separate scripts it still doesn't display the new value. I have tried using the SLEEP command for as much as 10 seconds between storing and retrieving cookie data and it doesn't solve the problem.
The only way around it is to store the data to be written in a variable (this is usually required anyway), then write the variable data to the cookie and display the VARIABLE instead of $ENV{'HTTP_COOKIE'}. This ensures the current value is displayed, but this method is not always convenient.