My Perl application uses Rose::DB, Rose::DB::Object (ORM) and Tk on Windows XP. I need to check whether the database connection information (host, port, database name, user, password) leads to a valid connection. If I call $db->connect
and use e.g. a nonexistant host for testing, Rose::DB says:
DBI connect('dbname=my_db;host=192.168.70.85;port=5432','postgres',...) failed:
could not connect to server: No route to host (0x00002751/10065)
How do I catch this and create a new message for my application? Is this a question about try/catch in general?
Thank you for your help!