Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Dear Monks,

I am working on a cookie-managed community system but my cookies expire too inaccurately, in detail: too early.
I am using Apache 1.27x on a Win32 (NT 5.1) machine, ActiveState Perl 5.6 and the module CGI.
With the script shown below, the cookie is supposed to expire 10 minutes after being set. I have counted the time and found out that it actually expired after 8 minutes and ~50 seconds. When I do this test again with -expires => "+30s", the cookie won't be set at all.
Do you have any Ideas how this problem can be solved?
#!C:\Perl\bin\perl.exe use strict; use CGI; my $q = CGI->new(); my $service = $q->param('service') || ''; &printCookieContent() if ($service eq 'showcookie'); sub printCookieContent { my $cookie = $ENV{HTTP_COOKIE}; my ($name, $value) = split(m/=/, $cookie, 2); print $q->header('text/html'); print "$name<br>$value"; exit; } my $cookie = $q->cookie( -name => "Testname", -value => "Testvalue", -domain => "abroxa.dyndns.org", -expires => "+10m", -path => "/cgi-bin" ); print $q->header(-type => 'text/html', -cookie => $cookie); print qq ~<a href="cookietest.cgi?service=showcookie">klick here to te +st the cookie</a>~; exit;
BioHazard
reading between the lines is my real pleasure

In reply to Cookie expires inaccurately by BioHazard

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    erix .oO( note to self: running 100 syncing database instances on a single machine is hard on the hard disks )
    [1nickt]: Oh, no, sins of the flesh were *especially* verboten at that monastery!

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (5)
    As of 2017-12-13 13:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What programming language do you hate the most?




















      Results (367 votes). Check out past polls.

      Notices?