[Parseperl-discuss] [PATCH] Localizing $_
Brought to you by:
adamkennedy
|
From: Chris D. <ch...@ch...> - 2006-10-04 18:49:05
|
PPI makes heavy use of unlocalized $_. This mangles any existing $_ in surrounding code, which is bad form. The attached patch changes all $_ assignments to lexical vars. A nice side effect is that it makes the code much more readable. The performance hit from this patch is about 1.0+/-0.5%, based on running "make test" with and without it three times each. If this degradation is real and not just normal variability, is this patch acceptable? Along the way, I fixed a bug in PPI::Tokenizer::get_token where $_ was used in multiple contexts and got overwritten incorrectly. The code worked by coincidence only. Chris -- Chris Dolan, Software Developer, http://www.chrisdolan.net/ Public key: http://www.chrisdolan.net/public.key vCard: http://www.chrisdolan.net/ChrisDolan.vcf |