Closed salva closed 8 years ago
$! may potentially be changed by any perl built-in and so, identifying all the places where it could be changed and adding more fine grained localizations (as in the $@ case), is not IMO, a viable approach.
I placed it at that particular location because it is just after the performance critical code. So it doesn't slow down logging calls that are skipped but then protects everything else.
I have not run any benchmark, and the cost of localizing $! may well be negligible compared to the _should_log method call, so maybe it would be better to place it just at the subroutine enter.
I ended up merging this from the CLI. Thanks!
Logging methods shouldn't modify globals. Specially
$@
and$!
.