Skip to content
  • Michael Pyne's avatar
    dep-resolv: Fix Perl warning about non-numeric comparison. · 2ca16048
    Michael Pyne authored
    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.
    2ca16048