On Thu, 17 Oct 2002, Roger Burton West wrote:

> I have a system with a lot of classes, all in the same namespace -
> Foo::Bar, Foo::Baz, Foo::Qux, etc. I'm expecting users of the program to
> add more classes; these may be in the main program or in additional
> files. Is there a way in which the program can get a list of
> the names of all Foo::* classes that have been defined?

grep { /::$/ } keys %Foo::

or close. I use this sort of trick all the time for generating code and 
namespaces.

S.

-- 
Shevek
I am the Borg.

sub AUTOLOAD{my$i=$AUTOLOAD;my$x=shift;$i=~s/^.*://;print"$x\n";eval
qq{*$AUTOLOAD=sub{my\$x=shift;return unless \$x%$i;&{$x}(\$x);};};}

foreach my $i (3..65535) { &{'2'}($i); }



Reply via email to