/usr/share/perl5/Perlbal/Util.pm is in libperlbal-perl 1.80-2.
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 | # misc util functions
#
=head1 NAME
Perlbal::Util - Utility functions internal to Perlbal
=cut
package Perlbal::Util;
use strict;
use warnings;
no warnings qw(deprecated);
sub durl {
my ($txt) = @_;
$txt =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
return $txt;
}
=head2 C< rebless >
Safely re-bless a locked (use fields) hash into another package. Note
that for our convenience elsewhere the set of allowable keys for the
re-blessed hash will be the union of the keys allowed by its old package
and those allowed for the package into which it is blessed.
=cut
BEGIN {
if ($] >= 5.010) {
eval q{
use Hash::Util qw(legal_ref_keys unlock_ref_keys lock_ref_keys)
};
*rebless = sub {
my ($obj, $pkg) = @_;
my @keys = legal_ref_keys($obj);
unlock_ref_keys($obj);
bless $obj, $pkg;
lock_ref_keys($obj, @keys,
legal_ref_keys(fields::new($pkg)));
return $obj;
};
}
else {
*rebless = sub {
my ($obj, $pkg) = @_;
return bless $obj, $pkg;
};
}
}
1;
# Local Variables:
# mode: perl
# c-basic-indent: 4
# indent-tabs-mode: nil
# End:
|