FAQ

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
one, preserve all, preserve what is requested in arguments? Once again,
seems over-complicated for something done so rarely, and so easy to just do
without a mechanism.

You could possibly make it a parameter to ->release

->release({ no_restore => 1 }) # don't restore anything
->release({ no_restore => [qw( $@ )] }) # only avoid restoring $@

But then you might be slowing down the code-path of "release" by
having an additional condition.

Though I think given how infrequently you'll need nuanced control over
variables, "no_restore => 1" is the only thing you need short term, as
the combination of "preserve everything" or "preserve nothing" are
both simple enough to be useful.

Either way, if preserve/restore are to be done by the context without
any user side control, the simplest way of avoiding
the undesired side effects should be documented to discourage the user
doing cheap tricks that cause future maintenance headaches.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 24 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