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

--- Comment #3 from Jonathan Druart <[email protected]> 
---
(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.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to