Subject: | Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/site_perl/5.6.1/DBIx/Abstract.pm line 801 |
I use PostgreSQL data base with DBI and DBD::Pg driver.
If a request returns empty result, the return value of fetchrow_arrayref or fetchrow_hashref is undefined. To avoid problem mentioned in subject one must handle this special case. I'd suggest the following changes:
782c782
< my $result = $db->fetchrow_hashref or return {};
---
Show quoted text
> my $result = $db->fetchrow_hashref;
791c791
< my $result = $db->fetchrow_arrayref or return [];
---
Show quoted text> my $result = $db->fetchrow_arrayref;
800c800
< my $result = $db->fetchrow_arrayref or return ();
---
Show quoted text> my $result = $db->fetchrow_arrayref;
813c813
< my $result = $db->fetchall_arrayref() or return {};
---
Show quoted text> my $result = $db->fetchall_arrayref();