Created
September 25, 2008 10:32
-
-
Save tokuhirom/12797 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# see http://rt.cpan.org/Public/Bug/Display.html?id=37027#txn-497961 | |
use strict; | |
use warnings; | |
use DBI; | |
use YAML; | |
use IO::Prompt; | |
&main; exit; | |
sub d { | |
my $dbh = shift; | |
my $sth = $dbh->prepare("SELECT * FROM user"); | |
$sth->execute(); | |
print YAML::Dump([map { $_->[1] } @{$sth->fetchall_arrayref()}]); | |
} | |
sub main { | |
my $dbh = DBI->connect("DBI:mysql:database=mysql;mysql_auto_reconnect=1", "root", '', {mysql_auto_reconnect=>1}); | |
d($dbh); | |
prompt("wait >"); # restart mysql here | |
d($dbh); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment