[Koha-bugs] [Bug 18332] Add the Koha::Objects->last method

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Mar 31 09:34:46 CEST 2017


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.de.rooy at rijksmuseum.nl

--- Comment #5 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
+    my $result = $self->_resultset->slice($count - 1, $count)->first;

Why do not do this:
    my ( $result ) = $self->_resultset->slice($count - 1, $count - 1);

Strictly speaking, you call slice with an invalid argument; since the index
starts at 0, $count is past the last element.
Instead of calling in scalar context and doing first, you should call in list
context?
Adding a follow-up.

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


More information about the Koha-bugs mailing list