home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


8.28 CGI::Cookie

Provides an interface to Netscape (HTTP/1.1) cookies that can be used in conjunction with CGI.pm or independently. To use CGI::Cookie, you create a new cookie object with the constructor new . You can then send the cookie to the browser in one of the following ways:

  • From a CGI script, create a Set-Cookie field in the HTTP header for each cookie you want to send ( $c is the cookie object):

    print "Set-Cookie: $c0";

  • With CGI.pm (see Chapter 10 ), use the header method with a -cookie argument:

    print header(-cookie=>$c);

  • Using mod_perl (see Chapter 11, Web Server Programming with mod_perl ), use the request object's header_out method:

    $r->header_out('Set-Cookie',$c);

The following methods are provided for CGI::Cookie:


Previous: 8.27 CGI::Carp Perl in a Nutshell Next: 8.29 CGI::Fast
8.27 CGI::Carp Book Index 8.29 CGI::Fast

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.