>> On 2002-10-17 22:24:18, Roger Burton West <[EMAIL PROTECTED]> said:

   > 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?

This might almost be a useful time to pimp my own Acme-type, since
everyone else is and it seems relevant.  base::Glob lets you create
Java-style globbed ISAs.  

So:

   package Class::Bar; sub method {2};
   package Nomatch::Foo; sub method {3};
   package main;
   use base::Glob qw(Class::*);
   print main->method(); # prints 2

It uses Devel::Symdump for the package list - or you could just crawl
the symbol table yourself - so you could scoop that part out if you
don't need to require each of the new classes..

- Chris.
-- 
$a="printf.net";  Chris Ball | chris@void.$a | www.$a | finger: chris@$a


Reply via email to