FAQ
The magic is already there, but it is there by localizing the vars in a ton
of non obvious places. Between that and having it done in one obvious and
documented place seems like a Much better option.
On Jan 11, 2016 7:21 PM, "Kent Fredric" wrote:
On 12 January 2016 at 16:14, Chad Granum wrote:
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
preserve them for all tools automatically...

As written, that suggestion scares me slightly, because its behaviour
wouldn't be entirely obvious that it does that.

I'd be fine with a system like:

my $error_state = save_errors();
...
restore_errors($error_state);
return $value;

Or

return preserve_errors(sub{
/* code that can generate errors that shouldn't leak */
});

Just lumping it in with the "Context" object seems too magical.

--
Kent

KENTNL - https://metacpan.org/author/KENTNL

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 28 | next ›
Discussion Overview
groupcpan-workers @
categoriesperl
postedJan 12, '16 at 12:53a
activeJan 18, '16 at 10:52p
posts28
users8
websitecpan.org

People

Translate

site design / logo © 2018 Grokbase