Re: Should Test2 maintain $! and $@?

2016-01-17 Thread Chad Granum
I can add a complex mechanism, or someone can just do this: sub modifies_err { > my $ctx = context(); > ... > my $err = $@; > $ctx->release(); > $@ = $err; > return ...; > } It is unlikely anyone would want to have $@, $!, and $?, all at once, but just as easy to

Re: Should Test2 maintain $! and $@?

2016-01-17 Thread Chad Granum
Just realized my response may not have been clear. My response assumes that context() DOES store $!, $@ and $?. And that release() restores them. I was saying that it is easy to get around this magic in the very rare case you want to. Most cases will not have any need to work around it as it is a

Re: Should Test2 maintain $! and $@?

2016-01-17 Thread Aristotle Pagaltzis
* Chad Granum [2016-01-12 04:20]: > That said, it just occured to me that this can possibly be > accomplished by having a context store $! And $@ when it is obtained, > then restore them when it is released, which would avoid needing to > use local everywhere, and still

Re: Should Test2 maintain $! and $@?

2016-01-17 Thread Kent Fredric
On 18 January 2016 at 18:53, Chad Granum wrote: > Then again, if you /really/ want the mechanism in $ctx, I can add > $ctx->release_preserving (naming is hard, give me a better one) which does > have the behavior... but at that point, which behavior do you want, preserve >