[Koha-bugs] [Bug 19809] Koha::Objects::find calls do not need to be forbidden in list context

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Apr 27 10:26:49 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19809

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|BLOCKED                     |Failed QA

--- Comment #4 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
My first feeling is that if we allow list context, we should return an empty
list instead of undef. It would fix your if( @a ) test since  @a==0. But what
would pop up again? Constructions like the one in Objects.t:
my $patrons = {
        foo => Koha::Patrons->find('foo'),
        bar => 'baz',
};
This would generate "Odd number of elements in anonymous hash" warnings and
mixup of hash keys and values. So we should have to add scalars again in the
parameter hashes.
So the question actually becomes: Where do we want to add scalars?
Imo the current situation helps us to identify problems immediately. If you
want to add a "push @a, Koha::Objects->find($b)" you will crash rightaway and
see that you must add a scalar. The other way around, the empty list in the
anonymous hash will not popup right away, so the problem may go unnoticed. For
me, the balance goes to keeping the forbid-list-context.
Moving to FQA but could have been ID too.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list