Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to a server that's not running #26

Closed
johto opened this issue Nov 2, 2012 · 3 comments
Closed

Connecting to a server that's not running #26

johto opened this issue Nov 2, 2012 · 3 comments

Comments

@johto
Copy link

johto commented Nov 2, 2012

Hi,

Given this simple script:

# !/usr/bin/perl

use strict;
use warnings;

use DBI;
use DBD::Pg;
use DBIx::Connector;

my $dbconn = DBIx::Connector->new("dbi:Pg:", '', '', {PrintError => 0});
my $dbh = $dbconn->dbh;

Executing that script when the database isn't running gives an extremely unhelpful error:

% perl notnice.pl
Can't call method "STORE" on an undefined value at /Library/Perl/5.12/DBIx/Connector.pm line 37.

I think it would be enough to return undef from _connect if you get undef back from DBI->connect, but you be the judge.

@theory theory closed this as completed in fe81577 Nov 2, 2012
@theory
Copy link
Collaborator

theory commented Nov 2, 2012

Please give that a try and let me know how it works. If it's more like what you expect, then great. But I also suggest that you set RaiseError => 1.

@johto
Copy link
Author

johto commented Nov 5, 2012

Works perfectly, thank you!

@theory
Copy link
Collaborator

theory commented Nov 5, 2012

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants