Skip Menu |

This queue is for tickets about the Safe CPAN distribution.

Report information
The Basics
Id: 31090
Status: resolved
Priority: 0/
Queue: Safe

People
Owner: Nobody in particular
Requestors: NKH [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: croak, die and Safe don't play well together
Safe version 2.12 Carp version 1.04 perl5 (revision 5 version 8 subversion 8) on a Gentoo box 1/ carp doesn't carp in reval use Safe ; eval "package ABC ; use Carp ;" ; eval('package ABC; croak "CROAKED in eval!" ;') ; print $@ if($@) ; my $compartment = new Safe('ABC') ; $compartment->reval ( 'print "before CROAKED in reval\n" ;' . 'croak "CROAKED in reval!" ;' . 'print "after CROAKED in reval\n" ;' ) ; print $@ if($@) ; $compartment->reval('die "DIED in reval!" ;') ; print $@ if($@) ; the test code above gives: CROAKED in eval! at safe_and_carp.pl line 7 before CROAKED in reval DIED in reval! at (eval 6) line 1. Note that "CROAKED in reval" is missing. in a real life example, execution would continue after the carp! 2/ Carp breaks die No test case simple enough to send. I'll be happy to help more. pseudo code 1 : $compartment->reval(die "DIED!") ; => DIES pseudo code 2 : eval "package ABC ; use Carp ;" ; $compartment(ABC) ; $compartment->reval(die "DIED!") ; => DOES NOT DIE I found these while working on Eval::Context. Chances are I'm doing something wrong although the test above shows a very weird behavior. I have tests whered replacing carp by die is enough to passed tests Nadim-NKH
This appears to be fixed in the Safe that comes with perl 5.10, and will be in the upcoming CPAN release of Safe.pm.