spacer
    spacer    
an About site
  > Advertise on this site
  > About Banking Center
  > Auctions
spacer
  You are here:   About > Computing/Technology > Perl
spacer
spacer
Your Guide spacer Perl
with  Emmie Lewis  Your Guide to One of Over  700 Sites
 
spacer
 
Search for  
 
spacer
   Home · Recent Articles · Visit Forums · Chat Live · Contact Guide · Free Newsletter
spacer
spacer
               
Subjects
Download Perl
Perl Installation
PHP Installation
Beginning Perl
Intermediate Perl
Advanced Perl
Beginning PHP
MySQL
Beginning SQL
Web-Based E-Mail
Uploading Files
Debugging Perl
OOP
mod_perl
PerlScript
Perl PHP and XML
Libraries/Modules
File Locking
Regex
Forms Hosting
Remote Passwords
Banner Rotation
Chat Scripts
Clocks Scripts
Cookie Generators
Counter Scripts
Games Scripts
Image Scripts
Guestbooks
Perl Tricks & Tips

Subject Library 

All articles on this topic
 
Stay up-to-date!
Subscribe to our newsletter.

Do you like our sites?
Wish to share them with others - and earn money?
Become an Affiliate

How to use cookies in your Perl scripts

Dateline: 03/14/00

Introduction

Up until now most of the articles on this site have focused on simple scripts that accomplished simple tasks.  At most we have saved data to a file or a database, but none of the examples has shown you how to maintain state between sessions.  Why would you want to do that?  Well, if you're writing a guestbook script, you wouldn't really need to.  A person visits your site, gives you their information, and sees the result when you print the new guestbook.  But if you want to personalize your site in any way then you'll have to know about how to save information between pages or sessions.  For example, if you wanted to create a site that lets users pick and choose what to view.  Or maybe you'd like to write an online ordering system.  Or you need some way to track activity on your web site.  How would you do that?  One easy way to do it is to use cookies.
 

What is a cookie?

A cookie is a chunk of information that you're allowed to save on a client computer.  Normally, for security reasons, you are not allowed access to computers that visit your web page.  However, cookies are an exception that allow you to save information on someone's computer in a structured and somewhat limited fashion.
 

What does a cookie look like?

A cookie consists of a "name=value" pair, such as

USER_ID = 1234

In this case, the cookie is named 'USER_ID', and the value is '1234'.

You can also save information about the cookie, such as

  • The cookie's expiration date and time
  • The valid domain for the cookie
  • The valid server path for the cookie
  • Whether or not to use a secure channel for the cookie
A fully specified cookie looks something like this:

TEST_COOKIE=Famous%20Amos; domain=.mydomain.com; path=/; expires=Sat, 11-Mar-2000 22:52:37 GMT; secure

Cool.  Now that you know what a cookie looks like, the next step is to show you how to set and get them from your scripts.  Don't worry, its easy.  We'll use CGI.pm to do it for us.
 
 

Next Page How to set cookies with CGI.pm > Page 1, 2, 3, 4




Email this page!

Sponsored Links
WebContactPro- Smartest Way To Grow E-Business
Built-in shopping cart, unlimited autoresponders, list manager, form processor, database marketing, ad tracking, affiliate tracking, electronic coupon system and more.
http://www.webcontactpro.com/  (Listing fee: $0.38)
Techies.com
The leading career resource for technology professionals in the country. Find the hottest tech jobs. Online training. Valuable career tips. And the inside scoop on local companies.
http://techies.com/  (Listing fee: $0.37)
Find Practically Anything on Earth at eBay!
eBay - the world's largest online trading site where people buy, sell or trade practically anything on earth. Over 4 million items available in over 4,000 categories including perl
http://cgi.ebay.com/  (Listing fee: $0.30)
The JSP Resource Index
The most comprehensive, searchable index of JavaServer Pages applications, beans, scripts, tutorials and references. Arranged by reviews, ratings, price, version, hits and more.
http://www.jspin.com/  (Listing fee: $0.16)
Advanced Minds Internet Solutions
Offers domain name sales, virtual hosting, dedicated hosting, NT hosting and other internet needs.
http://www.advancedminds.com/  (Listing fee: $0.15)
Sponsor this site More...



Related Sites
spacer
from About & Partners
  Focus on Java
Focus on JavaScript
Focus on Linux
HTML/XML
Internet Technology
Personal Web Pages
Web Design
Also Recommended
IRT.org
Senac

 
spacer
 
 Advertising
AllBusiness.com
Create your business plan. Here’s how.

Albert Interfacer
Albert, your Intelligent Search Engine

HotJobs.com
Better Jobs for a Better Life

Anything, Anytime, Anywhere
...save Time & Money at DealTime

Marketplace
- - free stuff - -
get a website$499
free credit report
$$$$ win big $$$$
free tech stuff
high paying jobs
free ebiz solutions
bills to big?
$50 off mp3 player
longdistancedeal
cheap computers
$$$$ win big $$$$
bargain getaways
free credit report
here's$10 go $hop


           
spacer spacer
   Search   
spacer spacer spacer spacer
Explore More on the About Network!
About Australia
About Canada
About India
About Ireland
About UK

Arts/Literature
Autos
Cities/Towns
Comedy
Computing/Technology 
Cultures 
Education
Entertainment
Food/Drink
Finance/Investing
Gadgets
Games
Health/Fitness
Hobbies
Home/Garden
Homework Help
Industry
Internet/Online 
Kids
Jobs/Careers
Money
Movies
Music/Performing Arts
News/Issues
Parenting/Family
People/Relationships 
Pets
Recreation/Outdoors
Real Estate
Shopping
Religion/Spirituality
Science
Small Business
Sports
Style
Teens
Travel
TV/Radio
spacer
spacer spacer
 
About Us | User Agreement | Privacy & Kids' Privacy Policy | Help
Copyright  © 2000 About.com, Inc.
About and About.com are registered trademarks of About.com, Inc.
The About logo is a trademark of About.com, Inc.
All rights reserved.