Le 18/03/2010 15:30, Colin Campbell a écrit :
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.
I do not understand, perhaps I could do :
return $sth->fetchrow_hashref;

But I don't understand why return an arrey context as it will normally returns an hashref.

bests,

--
Nahuel ANGELINETTI

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to