--- Coro-Mysql/Mysql.pm 2011/02/17 02:05:14 1.9 +++ Coro-Mysql/Mysql.pm 2012/07/26 21:38:00 1.12 @@ -102,7 +102,7 @@ sub writable { &Coro::Handle::FH::writable } BEGIN { - our $VERSION = '1.02'; + our $VERSION = '1.2'; require XSLoader; XSLoader::load Coro::Mysql::, $VERSION; @@ -121,12 +121,17 @@ returned unchanged. That means it is harmless when applied to database handles of other databases. +It is also safe to pass C, so code like this is works as expected: + + my $dbh = DBI->connect ($database, $user, $pass)->Coro::Mysql::unblock + or die $DBI::errstr; + =cut sub unblock { my ($DBH) = @_; - if ($DBH->{Driver}{Name} eq "mysql") { + if ($DBH && $DBH->{Driver}{Name} eq "mysql") { my $sock = $DBH->{sock}; open my $fh, "+>&" . $DBH->{sockfd} @@ -137,7 +142,7 @@ $fh = Coro::Handle::unblock ($fh); } - _patch $sock, $DBH->{sockfd}, $fh, tied ${$fh}; + _patch $sock, $DBH->{sockfd}, $DBH->{mysql_clientversion}, $fh, tied ${$fh}; } $DBH