how to find all current package names?
:
: You have a script. You've included some libraries,
:so you have more than just %_main. Now, how would you find out
:the names of all of the current packages?
This will get you 99.9% of the way. it would miss some pathological cases
that you probably can't generate without trying really hard, such as
package names that aren't valid identifiers. But if you're doing that,
you'll probably understand how to modify this code to find them, too.
foreach $package (keys %_main) {
next unless $package =~ /^_/;
$val = $_main{$package};
next unless $val =~ /^StB/;
*stab = eval("*$package");
foreach $ident (keys %stab) {
print substr($package, 1)."\n" if $stab{$ident} =~ /^StB/;
last;
}
}
--tom
--
It is, of course, written in Perl. Translation to C is left as an