in reply to Arbritrarily requireing classes.
method is the one I use often. I'd name the variable $package though, because you're not actually naming the file. I sometimes even eval a 'use', so the import get's run. Be sure to keep checking $@ afterwards though... Not doing so is asking for trouble. You may want to expand the die a bit, something like:eval "require $classFile;";
This'll just make the error messages a bit clearer for ya...die "Error during dynamic require of $classFile:\n$@"
|
|---|