On Wed, Mar 27, 2002 at 11:33:09AM +0000, Rob Thompson wrote: > OK... does anyone know of any good reason why I shouldn't do this to > determine which packages/objects I use at runtime?
Not really, you have a slight style nit here though. > #!/usr/local/perl5/bin/perl -w > use strict; > my $objtype = "object1"; > eval "require report::$objtype;"; > my $myobject = $objtype->new(); > my $objtype2 = "object2"; Here you're expecting the file report/object1.pm to just define the C<object1> namespace, but ideally it'd define C<report::object1> instead. It's also considered better style to have your packages use StudlyCaps::Names since all lowercase names are reserved for pragmas. Otherwise it's fine, assuming you launder $objtype accordingly. People (well I) do this all the time. -- Richard Clamp <[EMAIL PROTECTED]>