Permalink
Browse files

don't make wrapper subs for UNIVERSAL ones if the current package alr…

…eady defines them
  • Loading branch information...
1 parent 664d79e commit 9ed875b271fe9f16712fccbd198a53bc167c6553 @nothingmuch committed Feb 1, 2008
Showing with 4 additions and 1 deletion.
  1. +2 −0 lib/Data/Thunk/Code.pm
  2. +2 −1 lib/Data/Thunk/Object.pm
View
2 lib/Data/Thunk/Code.pm
@@ -63,6 +63,8 @@ sub ref {
foreach my $sym (keys %UNIVERSAL::) {
no strict 'refs';
+ next if $sym eq 'ref::';
+ next if defined &$sym;
*{$sym} = eval "sub {
if ( Scalar::Util::blessed(\$_[0]) ) {
unshift \@_, \$sym;
View
3 lib/Data/Thunk/Object.pm
@@ -38,8 +38,9 @@ sub ref {
foreach my $sym (keys %UNIVERSAL::) {
- next if $sym eq 'ref::';
no strict 'refs';
+ next if $sym eq 'ref::';
+ next if defined &$sym;
*{$sym} = eval "sub {
my ( \$self, \@args ) = \@_;

0 comments on commit 9ed875b

Please sign in to comment.