MYsql 与perl...帮我写一断连接代码..

MYsql 与perl...帮我写一断连接代码..

MYsql 与perl...帮我写一断连接代码..
最好加上注释....

怎么才能判断perl连接上了mysql...等调试代码....
谢谢
看programming DBI
perldoc DBD::mysql
用什么接口连接的?
use DBI;


$dbh = DBI->connect('DBI:driver:database_name', 'username', 'auth',

            { RaiseError => 1, AutoCommit => 1});

$dbh->do($sql);

$sth = $dbh->prepare($sql);

$sth->execute();

while (@row = $sth->fetchrow_array) {

    # ...

}

$sth->finish();

$dbh->disconnect();