diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Safe.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/Safe.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Master/tlpkg/tlperl/lib/Safe.pm b/Master/tlpkg/tlperl/lib/Safe.pm index bca4dfe8e6b..70549c5f4e8 100644 --- a/Master/tlpkg/tlperl/lib/Safe.pm +++ b/Master/tlpkg/tlperl/lib/Safe.pm @@ -2,9 +2,9 @@ package Safe; use 5.003_11; use strict; -use Scalar::Util qw(reftype); +use Scalar::Util qw(reftype refaddr); -$Safe::VERSION = "2.27"; +$Safe::VERSION = "2.29"; # *** Don't declare any lexicals above this point *** # @@ -134,6 +134,7 @@ my $default_share = [qw[ &version::vxs::stringify &version::vxs::new &version::vxs::parse + &version::vxs::VCMP ]), ($] >= 5.011 && qw[ &re::regexp_pattern ])]; @@ -362,10 +363,12 @@ sub reval { return (wantarray) ? @subret : $subret[0]; } +my %OID; sub wrap_code_refs_within { my $obj = shift; + %OID = (); $obj->_find_code_refs('wrap_code_ref', @_); } @@ -377,6 +380,10 @@ sub _find_code_refs { for my $item (@_) { my $reftype = $item && reftype $item or next; + + # skip references already seen + next if ++$OID{refaddr $item} > 1; + if ($reftype eq 'ARRAY') { $obj->_find_code_refs($visitor, @$item); } |