SunQuest
           Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 4th, 2008, 09:04 AM
JWest46088 JWest46088 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 39 JWest46088 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 2 m 10 sec
Reputation Power: 2
Other Language - Cookies in Perl

Can someone show me an example on how to use cookies?

I've been trying to find an easy example online, but I don't understand them.

Here is what I got out of it, but it doesn't work:

Code:
      use CGI qw/:standard/;
      use CGI::Cookie;
      $cookie = new CGI::Cookie(-name => 'filename', -value => 'grades');
      $cookie2 = new CGI::Cookie(-name => 'direction', -value => 'Reverse');
      print header(-cookie => [$cookie, $cookie2]);
      %cookies = fetch CGI::Cookie; 
      $filename = $cookies{'filename'} -> value;
      $direction = $cookies{'direction'} -> value;
      print "Set-Cookie: $cookie\n";



I'm assuming that the -name is the name field in the form and the -value is the value field but who knows. So, if I have a form with a text box whose name is filename and value is whatever is put in the textbox and three radio buttons with the name direction and values forward, reverse, and reversebackward. How would I make a cookie so that if the user leaves the page, they will get the same filename they put in the textbox and the same direction radio button they selected when they return to the page?

Reply With Quote
  #2  
Old April 7th, 2008, 12:53 PM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,163 Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 21605 Folding Title: Starter FolderFolding Points: 21605 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 3 h 34 m 39 sec
Reputation Power: 684
Could a moderator move this to the PERL forum. Thanks
__________________
The liver is evil and must be punished!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Other Language - Cookies in Perl


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway