Thread: cookies??

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    16
    Rep Power
    0


    how do you use Perl to write out cookies.
    I've got it down in JavaScript, but I'd like to switch it to server-side, and I'm already using perl, so it seems most logical here.

    are there any references or tutorials on the web maybe?


    THANKS!!!


    CujoRbd


  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    There are many ways to use it. You can use CGI.pm or try HTTP:Cookies from -> http://www.perl.com/CPAN-local/modul...rl-5.48.tar.gz

    Extract it and read Cookies.pm in HTTP directory.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Charleston, SC, USA
    Posts
    10
    Rep Power
    0
    A simple example using CGI.pm....

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    #!/usr/local/bin/perl
    use CGI;

    # change the next line to your cgi-bin dir.
    $thisCGI = '/cgi-bin/examples/setCookie';
    $query = new CGI;

    $cookThis = $query->cookie(-name=>'cookThis');
    if ($cookThis)
    {
    $cookie = $query->cookie(-name=>"cookThis",
    -value=>'',
    -expires=>"+1h");
    }
    else
    {
    $cookie = $query->cookie(-name=>"cookThis",
    -value=>"Netscape Version",
    -expires=>"+1h");
    }

    print $query->header(-cookie=>$cookie);
    print "<BR>CookThis is $cookThis<BR>";
    print $query->start_html(-title=>"UPLOAD THIS");
    print $query ->start_multipart_form('POST',"$thisCGI");
    print '<BR>',$query->submit('doWhat','cook');
    print $query->end_form;
    print $query->end_html;
    [/code]

    'hope this helps...

IMN logo majestic logo threadwatch logo seochat tools logo