in reply to grepping out global vars?
It's actually really easy to write a B:: module to do this. I spent a few minutes on this:
package B::FindGlobals; use B::Utils 'walkallops_filtered'; sub compile { return sub { walkallops_filtered( \&gv_only, \&report_global ); }; } sub gv_only { my $op = shift; return unless $op->name() =~ /^gv/; return unless $B::Utils::file eq $0; return 1; } sub report_global { my $op = shift; printf "%s: % 4d %s\n", $B::Utils::file, $B::Utils::line, $op->gv()->NAME(); } 1;
Install B::Utils, then run it on the file you want to check with perl -MO=FindGlobals filename.pl. You'll have to stuff this module somewhere in @INC under a B directory.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grepping out global vars?
by dragonchild (Archbishop) on Jan 18, 2005 at 14:11 UTC | |
by chromatic (Archbishop) on Jan 18, 2005 at 18:01 UTC | |
by dragonchild (Archbishop) on Jan 18, 2005 at 18:14 UTC | |
by chromatic (Archbishop) on Jan 18, 2005 at 21:11 UTC |