No, I regret to inform you there is no better way. You can and should include add a data stamp in every session entry, you can then go back through them letter with another script.

The whole Apache::Session::* is very undocumented, though I have read the src myself a few times. By default Apache::Session::DBI will store using a frozen copy of a Base64 bit encoded hash: This, thankfully, is easily reversible.

Here is some code that should show you the values you have stored, you can use this and a few simple sql tables, to move the data out of the frozen/base64 encoded hash into a real sql table.
use Storable q/thaw/; use MIME::Base64; use Data::Dumper; use DBD::Pg; use Carp; use Apache::Session::Serialize::Base64 qw/unserializie/; my $dbh = DBI->connect("dbi:Pg:dbname='TABLE_NAME'",q/postgres/,"",{Au +toCommit =>0}) || croak "Could not Connect to DB $DBI::errstr"; my $sth = $dbh->prepare(qq{ SELECT "a_session" FROM sessions }); $sth->execute(); + while ( my $col = ($sth->fetchrow_array)[0] ) { my %hash = %{ thaw(MIME::Base64::decode( $col ) ) }; while ( my ($k, $v) = each %hash ) { print "$col :\t $k => $v\n"; } }


Evan Carroll
www.EvanCarroll.com

In reply to Re: Apache::Session cleanup by EvanCarroll
in thread Apache::Session cleanup by garrison

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.