Skip to content

Instantly share code, notes, and snippets.

@justino
Created May 24, 2012 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justino/2784323 to your computer and use it in GitHub Desktop.
Save justino/2784323 to your computer and use it in GitHub Desktop.
Quick and dirty interchange session viewer
#!/bin/env perl
use strict;
use warnings;
use DBI;
use Storable qw( thaw );
use Data::Dumper;
my $dsn = 'dbi:mysql:[DB NAME];host=[HOST NAME];';
my $user = '[USER]';
my $pass = '[PASS]';
my $session = $ARGV[0];
my $dbh = DBI->connect($dsn, $user, $pass)
or die $DBI::errstr;
my $sql = q|
SELECT session
FROM sessions
WHERE code like CONCAT(?, '%')
|;
my $sth = $dbh->prepare($sql)
or die $dbh->errstr;
$sth->execute($session)
or die $sth->errstr;
my @results = $sth->fetchrow_array;
if (@results) {
my $session_data = $results[0];
print Dumper( thaw( $session_data ) ) . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment