Suggestions other than grep -b3 :-)

Jacqui Caren jacqui.caren at ntlworld.com
Thu Apr 13 18:10:13 BST 2006


Robin Berjon wrote:
> I would think that any regex that detects duplicate uses of the same  
> variable name following my in the same file, and then weeding out the  
> common ones ($i, $self) would find them all with minimal false  
> positives. If there's a lot of variable name reuse, then checking  that 
> there isn't a "^sub " between the two should kill the remaining  false 
> positives.

I should have said that I had pruned the example down to a minimal test
case. Sme of the subs have 100's of lines - with multiple possible 
places for such nasties to occur - including "flags" in iterations.

> Another option might be to use one of the B:: modules to walk all the  
> pads and check that there isn't any variable shadowing. Might be a  bit 
> painful though.

:-)



More information about the london.pm mailing list