[Koha-bugs] [Bug 16015] Cannot delete a group of libraries

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Mar 11 08:58:49 CET 2016


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

--- Comment #3 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
(In reply to Srdjan Jankovic from comment #2)
> This is totally weird. It must be that $libraries_count gets interpreted as
> "0". Perl, I did not expect that from you.
> Anyway, although this patch does solve the issue, pedantic devil in me says
> - wait.
> The way it is written says
> my $libraries_count = (scalar( $category->libraries ) > 0)
> which does yield correct boolean, but evaluates to 1 no matter how many
> libraries are there.
> Correct way could be
> my $libraries_count = scalar( $category->libraries ) + 0
> or
> (my $libraries_count = scalar( $category->libraries )) > 0

Do not worry, what you read is confusing :)
$category->libraries returns, in an array context, an array of DBIx::Class
objects.
But, in a scalar context, an ... iterator.
So it's always defined.
I will submit a patch to clarify the changes and avoid any confusions later.

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


More information about the Koha-bugs mailing list