in reply to check if DBI is still connected

Any of the above answers will suit you, but I found this solution to be useful for a similar task of mine, as it does most of the work for you:

our @connection = ($dsn, $user, $passwd, \%options); our $dbh = DBI->connect_cached( @connection ); sub do_query { my = shift; $dbh = DBI->connect_cached( @connection ); ## do query ## }

connect_cached() connects if you aren't currently connected. Of course, you can do this yourself by using:

unless ($dbh->ping) { $dbh = DBI->connect(@connection); }

But why?

<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law