• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Delete Cookie....


How can I add/delete a cookie  by using Perl only?
I think JavaScript is not suitable for me becauae I don't want the user can know how can I set the cookie by viewing the source page


1 Solution
To set a cookie:


use CGI;

$query = new CGI;

    $cookie = $query->cookie(-name=>'pass',
    print $query->header(-cookie=>$cookie);

print "Content-type: text/html\n\nDONE";

You cannot delete a cookie as that would be like deleting files on a client machine  which you obviously can't do.  However you will notice that you can set an "expires"  which in my example is one hour...  Hope this helps.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now