Skip to content

Instantly share code, notes, and snippets.

@nihen
Created December 14, 2011 08:15
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 nihen/1475700 to your computer and use it in GitHub Desktop.
Save nihen/1475700 to your computer and use it in GitHub Desktop.
use DBI;
use Data::Dumper;
my $dbh = DBI->connect('dbi:mysql:database=sandbox', 'sandbox', 'sandbox');
$dbh = $dbh->clone();
warn Dumper($dbh);
$dbh = $dbh->clone();
warn Dumper($dbh);
===============結果
$VAR1 = bless( {}, 'DBI::db' );
$VAR1 = bless( {}, 'DBI::db' );
================
なんだだけど、
==================
use DBI;
use Data::Dumper;
my $dbh = DBI->connect('dbi:mysql:database=sandbox', 'sandbox', 'sandbox');
$dbh = $dbh->clone({});
warn Dumper($dbh);
$dbh = $dbh->clone();
warn Dumper($dbh);
===============結果
$VAR1 = bless( {}, 'DBI::db' );
$VAR1 = undef;
==================
clone({})にするだけでこうなってしまうorz
DBI: 1.616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment