Although scalar(%hash) is 0 when the hash is empty, the rest of the time it is not a number.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/ObjectModel/Collection.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm index a57a32942..032c7386d 100644 --- a/testbot/lib/ObjectModel/Collection.pm +++ b/testbot/lib/ObjectModel/Collection.pm @@ -420,8 +420,9 @@ sub IsEmpty($) }
# Even though scalar(hash) does not return the number of items in Perl 5.20 - # it returns 0 for an empty hash. - return !$self->{Items} || scalar(%{$self->{Items}}) == 0; + # (and cannot generally be compared to numbers), it evaluates to true for + # all hashes except empty ones. + return !$self->{Items} || !%{$self->{Items}}; }
sub CombineKey($@)