package PatchPackages; use strict; use version; our $VERSION = qv/0.0.1/; sub import { require Scalar::Util; if (! Scalar::Util->can('refaddr')) { # Copied from more recent Scalar::Util code. # Makes up for this function being missing on some # of our 5.8.0 installations. *Scalar::Util::refaddr = sub ($) { my $pkg = ref($_[0]) or return undef; if (Scalar::Util::blessed($_[0])) { bless $_[0], 'Scalar::Util::Fake'; } else { $pkg = undef; } "$_[0]" =~ /0x(\w+)/; my $i = do { local $^W; hex $1 }; bless $_[0], $pkg if defined $pkg; $i; } } } 1;