develooper Front page | perl.perl5.porters | Postings from June 2004

Re: [perl #29851] Problem with Carp and Safe

Thread Next
Lionel CONS
June 1, 2004 03:48
Re: [perl #29851] Problem with Carp and Safe
Message ID:
Dave Mitchell via RT writes:
 > Carp will sometimes do:
 >     { local $@; require Carp::Heavy; }
 > Since require isn't allowed within the compartment, Perl raises an exception;
 > control is unwound to the eval done by the Safe::reval, then all the saved
 > stuff like the local()s are unwound, thus blowing away the error message
 > in $@.

Thanks for the explanation. I hope that this will get fixed in a
future version of the Carp module.

However, rather than forcing the user to add "require Carp::Heavy" in
user scripts before being able to use carp() inside Safe, I would prefer
another solution. The main reason being that users may not even know
that carp() is used inside Safe (it may be buried way down in the code).
Another reason is the messing up of $@ (cf. the "XXX fix require to
not clear $@?" comment in the current Carp module).

What about having Carp doing all the work in a proper way (e.g. not
messing around with $@), just like it was before (e.g. for Perl 5.5)
and provding a Carp::Light with dirty autoload tricks for people who
care about startup time? I prefer a clean default Carp module and a
dirty one for people who really need optimisation...

Lionel Cons

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About