darshan_atha has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: cookie problem
by cLive ;-) (Prior) on Oct 16, 2002 at 04:50 UTC
    How about spending five minutes searching this site for the answer? And then, if you get stuck, explain why you're stuck?

    Your question is answered several times on this site. Why not show a little initiative and look for the answer before asking?

    .02

    cLive ;-)

    --

Re: cookie problem
by true (Pilgrim) on Oct 16, 2002 at 08:28 UTC
    my $expires = "Wed, 09-Nov-2002 00:00:00 GMT"; my $path = "/"; my $domain = "\."."$ENV{'SERVER_NAME'}"; print "Content-type:text/html\n"; print "Set-Cookie: myName=Azuba;"; if ($expires) {print " expires=$expires;";} if ($path) {print " path=$path;";} if ($domain) {print " domain=$domain;";} if ($secure) {print " secure";} print "\n\n";
    jtrue
      use CGI, please.

      To store...
      use CGI; use strict; my $q = new CGI; my %cookie_info; $cookie_info{id} = $q->param('id'); my $cookie = $q->cookie( -name => 'cookie_name', -value => \%cookie_info, -path => '/', -expires => '+1h', ); print $q->header(-cookie => $cookie); print 'done.';
      To read...
      use CGI; use strict; my $q = new CGI; my %cookie_info = $q->cookie('cookie_name'); print $q->header; print $cookie_info{id};
      See the CGI docs for more info.

      --
      Rock is dead. Long live paper and scissors!