Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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;
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