You know you're having a bad day when the following quick hack becomes an indispensable snippet that you bind to a key in vim:
#!/usr/bin/perl -l
use strict;
use warnings;
my $file = shift or die "usage: $0 lib";
use lib 'lib';
require $file or die "Cannot require $file";
foreach my $sym ( sort keys %:: ) {
next unless $sym =~ /^[[:word:]]+$/;
next if $sym =~ /^[[:digit:]]$/;
next unless `grep -l '[\@\$%]$sym' $file`;
print $sym;
}
That’s pretty terrible.
Re:Ouch
Ovid on 2006-09-20T14:28:29
And it's going to get a lot worse as I expand this to match what type of variable we have. I once joked about writing Symbol::Table::Find and Symbol::Table::Grep, but now I might have to!
Fortunately the programmers I work with are pretty sharp and our new code is much cleaner.