Suggestions other than grep -b3 :-)
Matt S Trout
dbix-class at trout.me.uk
Thu Apr 13 17:17:49 BST 2006
Robin Berjon wrote:
> On Apr 13, 2006, at 16:31, Jacqui Caren wrote:
>> Simon Wistow wrote:
>>> About the only thing I could suggest was either writing a Debugger or
>>> using PPI.
>>
>> a grep -b3 took 30 seconds to write and caught ~20 of the lill buggers.
>>
>> I was hoping someone would mention a "use lint" or similar :-)
>
> 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.
>
> 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.
Wouldn't it be easier to use PPI for the parsing?
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the london.pm
mailing list