in reply to This works, but at what cost...?
in thread Are dynamic 'use' statements possible?
Oh la la.
To answer your questions, yes, BEGIN {} only execute once when the module is compiled, and yes, you can use eval "use $module;"; in your new(). However (!!), how is your configuration module set up? Do you import variables into your own namespace from it? Or do the configuration modules share one namespace? In that case, loading a configuration module would affect all instances of your class.. and you're looking at a major mess.
Is there any reason you can't simply use an honest to god configuration file with something like Config::Inifiles, or at least my $config = do "config_in_anonymoushash.pl";?Makeshifts last the longest.
|
|---|