[Dbix-class] Detecting connection errors

David Ihnen davidihnen at gmail.com
Wed Oct 14 17:04:58 GMT 2015


I think we did something silly like doing a meaningless select/ping type
operation just to make sure everything was cool in the DBIx application I
worked on years ago.  There may be a better answer these days though?

David

On Wed, Oct 14, 2015 at 12:53 PM, Alberto Luaces <aluaces at udc.es> wrote:

> 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
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



-- 
David Ihnen
Voice contact (562) 743-1807
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20151014/f719f4b3/attachment.htm>


More information about the DBIx-Class mailing list