[Koha-bugs] [Bug 4450] Type of error return causes problems

bugzilla-daemon at kohaorg.ec2.liblime.com bugzilla-daemon at kohaorg.ec2.liblime.com
Fri May 7 16:06:11 CEST 2010


http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=4450





--- Comment #8 from Colin Campbell <colin.campbell at ptfs-europe.com>  2010-05-07 14:06:10 ---
I was trying to avoid code like this:
return undef is bad because it is ambiguous in a list context use return; For
example in the elsif case below if this is called in
a list context you are now returning not an error but a a one element array
(@{$data) has been expanded from [] to [ undef, ]
-

if ((ref($data) eq 'SCALAR') && ($data == -1)) {
    return undef;
}
elsif ((ref($data) eq 'ARRAY') && (scalar(@$data) == 0)) {
    return undef;
}

In the patch I was trying to ensure that error conditions were being caught by
making the returns consistent with how the calling routines were actually
testing the return and going for a perlish default where the returns were not
currently being tested. (in the hopes that this might be how people would
expect to test them)


-- 
Configure bugmail: http://bugs.koha.org/cgi-bin/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the Koha-bugs mailing list