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