in reply to Re: Database Search Approaches
in thread Database Search Approaches
I'm not sure why everyone keeps using string eval to load modules. Heck, even UNIVERSAL::require does it, which confounds the heck out of me.
Then it's as simple as eval { my_require($handlerClass); }. Eliminating all the delays and risks of string eval. Of course, if someone can put a new module in your @INC and update your table, that someone could be malicious, but I don't think there's much that you can do about that.sub my_require { my $class = shift; (my $pm = $class) =~ s(::)(/); $pm .= '.pm'; require $pm; # optional: # $class->import(); }
|
|---|