[Dbix-class] Detecting connection errors

Alberto Luaces aluaces at udc.es
Wed Oct 14 16:53:29 GMT 2015


Hi,

I stumped over a problem when learning to use DBIx::Class.  I had a typo
on the filename holding the database, but no exception was thrown until
I wanted to retrieve some results, which was not intuitive for me.  How
do you check for a successful connection?

--8<---------------cut here---------------start------------->8---
use My::Schema;

# Does not die even the filename is wrong!
my $r = My::Schema->connect("dbi:SQLite:expgraf.db") or die('conn error');
--8<---------------cut here---------------end--------------->8---

Thanks,

-- 
Alberto




More information about the DBIx-Class mailing list