[Koha-patches] [PATCH] (bug #4321) clean C4::Biblio::GetBiblio and uses
Colin Campbell
colin.campbell at ptfs-europe.com
Thu Mar 18 15:30:51 CET 2010
On 18/03/10 13:56, Nahuel ANGELINETTI wrote:
> + if ( my $data = $sth->fetchrow_hashref ) {
> + return $data;
> + }else{
> + return undef;
> + }
Its not a good idea to to return undef explicitly.
If the routine is called in an array context you get an array with
one element ( i.e. [ undef, ] ). Better to just return; which returns
undef in a scalar context and an empty array in an array context. Makes
for dafer code.
Colin
--
Colin Campbell
Chief Software Engineer,
PTFS Europe Limited
Content Management and Library Solutions
+44 (0) 208 366 1295 (phone)
+44 (0) 7759 633626 (mobile)
colin.campbell at ptfs-europe.com
skype: colin_campbell2
http://www.ptfs-europe.com
More information about the Koha-patches
mailing list