AnyEvent::Loop and $_
Mons Anderson
mons at rambler-co.ru
Fri Feb 10 15:44:26 CET 2012
On 09.02.2012 5:08, Marc Lehmann wrote:
>
> Yes, local is the usual defensive progamming idiom when modifying global
> variables. AnyEvent already does that, but you have to do that in your
> code as well, for any global variable you modify. "for" already does that
> for example.
>
> As a rule of thumb in perl coding: if you modify a global variable,
> restore it before returning.
>
> You can use AnyEvent::Strict (AE_STRICT=1 ./myprog) to catch these kinds
> of bugs - it should pinpoint which watcher is causing the problem when it
> happens.
>
I know. I always try to C<local $_> if use it. But that was not my own
code - that was a derived part from Mojolicious.
Thanks for AE::Strict hint. I'll try it when I again encounter such
situation.
--
Mons Anderson aka Vladimir Perepelitsa
<mons at rambler-co.ru>
Skype: inthrax; ICQ: 99779956
More information about the anyevent
mailing list