Perhaps this code will help:
#!/usr/bin/perl -w # ic_cookies - sample CGI script that uses a cookie use CGI qw(:standard); use strict; my $cookname = "favorite ice cream"; my $favorite = param("flavor"); my $tasty = cookie($cookname) || 'mint'; unless ($favorite) { print header(), start_html("Ice Cookies"), h1("Hello Ice Cream"), hr(), start_form(), p("Please select a flavor: ", textfield("flavor",$tasty)), end_form(), hr(); exit; } my $cookie = cookie( -NAME => $cookname, -VALUE => $favorite, -EXPIRES => "+2y", ); print header(-COOKIE => $cookie), start_html("Ice Cookies, #2"), h1("Hello Ice Cream"), p("You chose as your favorite flavor `$favorite'.");
This comes from Recipe 19.10 in the Perl Cookbook.
Discussion
The cookie was prepared with:
my $cookie = cookie( -NAME => $cookname, -VALUE => $favorite, -EXPIRES => "+2y", );
And the cookie was set with:
print header(-COOKIE => $cookie), start_html("Ice Cookies, #2"), h1("Hello Ice Cream"), p("You chose as your favorite flavor `$favorite'.");
I hope this helps.
UPDATE: Oh Boy! I missed the boat on this one. Please ignore this message!!
J. J. Horner Linux, Perl, Apache, Stronghold, Unix jhorner@knoxlug.org http://www.knoxlug.org/
In reply to (jjhorner)Printing BigInts
by jjhorner
in thread Printing BigInts
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |