in reply to Get Cookies for Form Input

This does what you asked for, you might have to adjust the cookie name (currently "sessionID"), and again, it's probably useless.

use warnings; use strict; use CGI qw(:standard); use CGI::Cookie; my $cookies = CGI::Cookie->fetch; my $cookie = $cookies->{sessionID} || cookie(-name => 'sessionID', -value => 0, ); $cookie->value( $cookie->value + 1 ); print header(-cookie => $cookie), start_html(), start_form(), textfield(-name => "cookie", -value => $cookie->value), submit(), end_form(), end_html();

Perhaps the Pod for the interface for CGI::Cookie will start to shake some things loose. What it sounds like to me now, from your new description, is that you have a completely insecure set of applications which are passing around customer information in cookie values. This is a huge no-no and I would hope and expect no one here would help you to get it working that way if it's really the case.

Without much more info, and probably lots of sample code, showing how and what the login and sessioning is doing through each app, everything else is just a guessing game.

Replies are listed 'Best First'.
Re^2: Get Cookies for Form Input
by Anonymous Monk on Sep 17, 2010 at 04:39 UTC
    Hi,

    Thank you for the script. It worked as it sets a cookie with dynamic content, creates and enters the content into an input box. My goal is to retrieve a pre-existing cookie and use the content as a <TMPL_VAR> tag --in an input box. However, it was very helpful as the $cookies = CGI::Cookie->fetch; when added to the application didn't crash my application script like $cgi_query = new CGI;. I have therefore begun to read he documentation for CGI::Cookie.

    I will try/ask around to see if I can modify and convert it to a subroutine to add it to the application.