Perl - SQLite question

Hello All,

I am trying to write a Perl script that is using 'SQLite' as the application needs a very light weight Database. I wanted to know how to catch exceptions when I run queries in SQLite. Without this the Perl script comes to a halt everytime an exception occurs. Please help.

Regards,
Garric

Are you using DBD::SQLite via DBI? And have you tried the "HandleError" attribute available in DBI?

DB - Database independent interface for Perl - search.cpan.org

Thanks for the documentation. I will go through it to see if I can use that.

Or can I do it in this manner?

eval
{
      my $sth = $dbh->prepare("$qstr");
      $sth->execute();
      $sth->finish();
};
if ($@)
{
       print "\nError with $host";
}

Surely yes, if that's your preference.