Mysql errors and Perl

clinty

Member


Messages: 69

Hello.

I use MySQL and shell Scripts to make some jobs. However, Shell is not a good idead to make some queries like SELECT. So, I'm testing Perl. It's better, but I have only one question:

I use this Packagefor MySQL databases. Is it possible to print a msg/stop the program/die the script when the query fail?

Example:

Code:
$q = 'SELEEEECT * FROM table;';
$link->query($q)
This query will fail because SELEEECT is not a valid MySQL command. And Perl does not print msg error.

In PHP, is that possible to do this thing:

Code:
$q = 'SELEEEECT * FROM table;';
mysql_query($q) or die(mysql_error())
Is that possible in Perl, with Mysql.pm ? I tried die() function, but noting is printed.

Thanks for your advices.
 
Top