How to skip database errors in perl
Posted on 2007-10-12
I've a perl script, in which I need to make multiple database connections in each sub function
DBI->connect(database1, user, passwd);
DBI->connect(database2, user2, passwd2);
my $sel1= DBI->prepare("Select...");
my $var1 = $sel1->fetchrow();
my $sel2= DBI->prepare("Select...");
my $var2 = $sel2->fetchrow();
Now, if there is any error or one of the database is down, the program shouldn't exit with error, rather it should continue to the next database connections.
Similarly, if there is any inside the subroutines, it shouldn't die, rather it should continue till the end of the program
How do I achieve this.