Rob Thompson <[EMAIL PROTECTED]> wrote: >OK... does anyone know of any good reason why I shouldn't do this to >determine which packages/objects I use at runtime?
Because you'll go blind... > #!/usr/local/perl5/bin/perl -w > use strict; > my $objtype = "object1"; > eval "require report::$objtype;"; > my $myobject = $objtype->new(); > my $objtype2 = "object2"; > eval "require report::$objtype2;"; > my $myotherobject = $objtype2->new(); > exit; One thing that might be preventing this from working, is that you are loading class report::foo, and then trying to create an object of type foo. If I was your computer, I'd be confused. Try my $class = 'report::' . $foo; eval 'require ' . $class; my $obj = $class->new; This code hsan't been tested, so consider the fact that it might work a bonus ;) Ian _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com