/usr/share/perl5/UR/Value/HASH.pm is in libur-perl 0.430-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 | package UR::Value::HASH;
use strict;
use warnings;
require UR;
our $VERSION = "0.43"; # UR $VERSION;
UR::Object::Type->define(
class_name => 'UR::Value::HASH',
is => ['UR::Value::PerlReference'],
);
sub __display_name__ {
my $self = shift;
my $hash = $self->id;
my @values;
for my $key (sort keys %$hash) {
next unless defined $hash->{$key};
push @values, "$key => '".( defined $hash->{$key} ? $hash->{$key} : '' ). "'";
}
my $join = ( defined $_[0] ) ? $_[0] : ','; # Default join is a comma
return join($join, @values);
}
sub to_text {
my $self = shift;
my $hash = $self->id;
my @tokens;
for my $key (sort keys %$hash) {
push @tokens, '-'.$key;
next if not defined $hash->{$key} or $hash->{$key} eq '';
if ( my $ref = ref $hash->{$key} ) {
if ( $ref ne 'ARRAY' ) {
$self->warning_message("Can not convert hash to text. Cannot handle $ref for $key");
return;
}
push @tokens, @{$hash->{$key}};
}
else {
push @tokens, $hash->{$key};
}
}
my $join = ( defined $_[0] ) ? $_[0] : ' '; # Default join is a space
return UR::Value::Text->get( join($join, @tokens));
}
1;
|