Searching around for Perl projects on Sourceforge led me to NMS. (Update: The library in question is called CookieLib). There is a a README, but it does not mention anything about this. Okay, I think, this is posted by London PM (or by members thereof), and the code is supposed to be more secure than MSA code. What I don't get is how this is supposed to be more secure:
sub SetCookies { my (%input) = @_; while( my($name,$value) = each %input ) { my $c = CGI->cookie ( -name => $name, -value => $value, -expires => ((exists($cookie_config{expir +es}) && $cookie_config{expires} ==1) ? $cookie_config{expires} : unde +f), -domain => ((exists($cookie_config{domai +n}) && $cookie_config{domain} ==1) ? $cookie_config{domain} : unde +f), -secure => ((exists($cookie_config{secur +e}) && $cookie_config{secure} ==1) ? $cookie_config{secure} : unde +f), -path => ((exists($cookie_config{path} +) && $cookie_config{path} ==1) ? $cookie_config{path} : unde +f), ); print "Set-Cookie: ", $c, "\n"; } }
Note the "==1"s. Also, the quickest glance through the CGI::Cookie perldoc shows that you can use values for -expires like '3M':
$c = new CGI::Cookie(-name => 'foo', -value => 'bar', -expires => '+3M', -domain => '.capricorn.com', -path => '/cgi-bin/database', -secure => 1 );
So, is the above supposed to be a secure version usage of the CGI::Cookie module? If so, why?

Update #2: As a result of my posting the following was appended to the modification history of CookieLib at NMS:

# $Log: cookielib,v $ # Revision 1.6 2006/04/08 08:34:31 gellyfish # Appeared to be a cut and paste error in SetCookies
And the code has, apparently, been modified. Thank you gellyfish for your prompt action.

Celebrate Intellectual Diversity

Moved from Perl Monks Discussion to Seekers of Perl Wisdom by planetscape


In reply to NMS, London PM? by InfiniteSilence

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, details, 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, summary, 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.