You can check your connection with attribute {Active}.
my $h=$dbh->{Active}; &reconnect if (!$h);

In reply to Re: mysql_auto_reconnect by idle
in thread mysql_auto_reconnect by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":