Skip to content

Commit

Permalink
die if the wrapper sub eval fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingmuch committed Feb 2, 2008
1 parent 1a312b0 commit b3f8aa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/Data/Thunk/Code.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ foreach my $sym (keys %UNIVERSAL::) {


next if $sym eq 'ref::'; next if $sym eq 'ref::';
next if defined &$sym; next if defined &$sym;

local $@;

*{$sym} = eval "sub { *{$sym} = eval "sub {
if ( Scalar::Util::blessed(\$_[0]) ) { if ( Scalar::Util::blessed(\$_[0]) ) {
unshift \@_, \$sym; unshift \@_, \$sym;
goto \$vivify_and_call; goto \$vivify_and_call;
} else { } else {
shift->SUPER::$sym(\@_); shift->SUPER::$sym(\@_);
} }
}"; }" || die $@;
} }


sub AUTOLOAD { sub AUTOLOAD {
Expand Down
5 changes: 4 additions & 1 deletion lib/Data/Thunk/Object.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ foreach my $sym (keys %UNIVERSAL::) {


next if $sym eq 'ref::'; next if $sym eq 'ref::';
next if defined &$sym; next if defined &$sym;

local $@;

*{$sym} = eval "sub { *{$sym} = eval "sub {
my ( \$self, \@args ) = \@_; my ( \$self, \@args ) = \@_;
Expand All @@ -50,7 +53,7 @@ foreach my $sym (keys %UNIVERSAL::) {
} else { } else {
return \$self->SUPER::$sym(\@args); return \$self->SUPER::$sym(\@args);
} }
}"; }" || die $@;


warn $@ if $@; warn $@ if $@;
} }
Expand Down

0 comments on commit b3f8aa9

Please sign in to comment.