Gossamer Forum
Home : General : Perl Programming :

perl programming

Quote Reply
perl programming
can any tell me how to use cookies in perl[cool]
Quote Reply
Re: [priya] perl programming In reply to
Basically to set a cookie;

Code:
my $cookie = $IN->cookie( -name => 'CookieName', -value => "whatever value of variable here", -path => '/', -expires => '+1y' );

# save the cookie...
print $IN->header( -cookie => $cookie );

And to read, something like;

Code:
my $cut_up = $IN->cookie('CookieName');

Thats pretty much the simplest terms to put it in Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [priya] perl programming In reply to
Btw - about two forums up from here is a perl forum which is where you needed to post this question :)
Quote Reply
Re: [Andy] perl programming In reply to
Hi Andy

While you're example is appreciated, I think it would be a good idea to note how one would actually populate $IN in your example and it's correlation to your snippet.

- wil
Quote Reply
Re: [priya] perl programming In reply to
See the CGI.pm docs for complete documentation.

http://stein.cshl.org/...oftware/CGI/#cookies

or simpler:

http://www.cs.unc.edu/...omp117_6/tsld017.htm
Quote Reply
Re: [Wil] perl programming In reply to
Whoops....good point.

To define $IN, use something like;

Code:
use CGI;
$IN = new CGI;


Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates