in reply to DBI returning error on selectrow_hashref

As perrin says, the error comes from not having a database handle object. The best way to prevent this kind of error is to always check that the connect() succeeds with
my $dbh = DBI->connect(...) or die DBI::errstr;
Or, the way I prefer:
my $dbh = DBI->connect($dsn,$usr,$pass,{RaiseError=>1});
Either of those ways will die with an appropriate warning if there is no $dbh object.
  • Comment on Re: DBI returning error on selectrow_hashref