This file is indexed.

/usr/share/perl5/perl5i/2/HASH.pm is in libperl5i-perl 2.13.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# vi: set ts=4 sw=4 ht=4 et :
package perl5i::2::HASH;
use 5.010;

use strict;
use warnings;

# Don't accidentally turn carp/croak into methods.
require Carp::Fix::1_25;
require Hash::StoredIterator;

use perl5i::2::Signatures;

method each($callback) {
    return Hash::StoredIterator::hmap( $callback, $self );
}

sub flip {
    Carp::Fix::1_25::croak("Can't flip hash with references as values")
        if grep { ref } values %{$_[0]};

    my %flipped = reverse %{$_[0]};

    return wantarray ? %flipped : \%flipped;
}

sub merge {
    require Hash::Merge::Simple;
    my $merged = Hash::Merge::Simple::merge(@_);

    return wantarray ? %$merged : $merged;
}

sub print {
    my $hash = shift;
    print join(" ", map { "$_ => $hash->{$_}" } keys %$hash);
}

sub say {
    my $hash = shift;
    print join(" ", map { "$_ => $hash->{$_}" } keys %$hash), "\n";
}

my $common = sub {
    # Return all things in first array that are also present in second.
    my ($c, $d) = @_;

    no warnings 'uninitialized';
    my %seen = map { $_ => 1 } @$d;

    my @common = grep { $seen{$_} } @$c;

    return \@common;
};

sub diff {
    my ($base, @rest) = @_;
    unless (@rest) {
        return wantarray ? %$base : $base;
    }

    die "Arguments must be hash references" if grep { ref $_ ne 'HASH' } @rest;

    # make a copy so that we can delete kv pairs without modifying the
    # original hashref.
    my %base = %$base;

    require perl5i::2::equal;

    foreach my $hash (@rest) {

        my $common_keys = $common->( [ keys %$base ], [ keys %$hash ] );

        next unless @$common_keys;

        # Keys are equal, are values also equal?
        foreach my $key (@$common_keys) {
            delete $base{$key} if perl5i::2::equal::are_equal( $base->{$key}, $hash->{$key} );
        }

    }

    return wantarray ? %base : \%base;
}

my $different = sub {
    # Return all things in first array that are not present in second.
    my ($c, $d) = @_;

    no warnings 'uninitialized';
    my %seen = map { $_ => 1 } @$d;

    my @different = grep { not $seen{$_} } @$c;

    return \@different;
};

sub intersect {
    my ($base, @rest) = @_;

    unless (@rest) {
        return wantarray ? %$base : $base;
    }

    die "Arguments must be hash references" if grep { ref $_ ne 'HASH' } @rest;

    # make a copy so that we can delete kv pairs without modifying the
    # original hashref.
    my %base = %$base;

    require perl5i::2::equal;

    foreach my $hash (@rest) {

        my $different_keys = $different->( [ keys %$base ], [ keys %$hash ] );

        delete @base{@$different_keys};

        return wantarray ? () : {} unless %base;

        my $common_keys = $common->( [ keys %$base ], [ keys %$hash ] );

        # Keys are equal, are values also equal?
        foreach my $key (@$common_keys) {
            delete $base{$key} unless perl5i::2::equal::are_equal( $base->{$key}, $hash->{$key} );
        }

    }

    return wantarray ? %base : \%base;
}

1;