I have found a really weird quirk! I am using Apache::Session::MySQL 1.86 (standard Debian Lenny install) in a mod_perl script to store epoch time so sessions can be set to expire. I have found that the time is being returned wrong. I started a discussion on linux questions which has more details. It also occurs when storing most integers. I made a simple script to demonstrate the problem:

#!/usr/bin/perl use strict; use DBI; use Apache::Session::MySQL; my $dbhg = DBI->connect("dbi:mysql:mydatabase","username","secret") or die "Could not open MySQL DataBase - SQL Error: $DBI::errstr\n" +; my %session; tie %session, 'Apache::Session::MySQL', undef, {Handle=>$dbhg, LockHan +dle=>$dbhg}; my $sessid = $session{_session_id}; print "New session:$sessid\n"; $session{'atime'} = 2000; print "Time set: $session{'atime'}\n"; untie %session; undef %session; tie %session, 'Apache::Session::MySQL', $sessid, {Handle=>$dbhg, LockH +andle=>$dbhg}; print "Connected session:$session{_session_id}\n"; my $retievedTime = $session{'atime'}; print "Retrieved time: $retievedTime\n"; untie %session;

And this returns:

New session:3498874a51b85f177eede9a7f584e3b0 Time set: 2000 Connected session:3498874a51b85f177eede9a7f584e3b0 Retrieved time: 1855

Even weirder is that when i print the value inside the STORE routine (to see whats going on in there) in Session.pm it works as it should as can be seen on the linux questions post.

Is this a bug in apache session that i should file? Can anyone work out whats going on?!? Thanks in advance.

Merlin


In reply to Apache::Session::MySQL appears to be misbehaving! by merlininthewood

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.