dep-resolv: Fix Perl warning about non-numeric comparison.

Authored by mpyne on Apr 13 2019, 1:33 AM.

Description

dep-resolv: Fix Perl warning about non-numeric comparison.

When sorting back edges for dependency 'votes' in the new dependency
resolver, dfaure encountered Perl warnings to the effect of:

> Argument "5/8" isn't numeric in numeric comparison (<=>) at
> /kdesrc-build/modules/ksb/DependencyResolver.pm line 776.

This turns out to be because converting an entire hash object into a
scalar value doesn't just return the number of key/value pairs, but
instead returns a string describing metadata about the hash object's
content (see https://perlmaven.com/perl-hash-in-scalar-and-list-context)

While this doesn't actually break sorting due to the way Perl constructs
the string, it does cause warnings about using numeric comparisons on
strings.

Fix by applying scalar to just the list of keys in the hash containing
votes, which is just a way to determine the number of keys in the hash.

Details

Committed
mpyneApr 13 2019, 1:39 AM
Parents
R365:141d71497879: Add a unit test job to the Gitlab CI pipeline.
Branches
Unknown
Tags
Unknown