http://qs321.pair.com?node_id=568765


in reply to Most effective way to dynamically load a module?

Eval works ok, but you're using the 'quote' version here, so i'd do a
if ($class !~ /^[a-z0-9_]*$/i) { print $cgi->header(); print "<h1> You tried something that's not allowed! </h1><br>< +br>"; exit(); }
before using the eval statement.
Alternative you'd be able to use:
eval { require $class . ".pm"; }; if ($@) { print $cgi->header(); print "$@"; print "<h1> The class '$class' does not exist! </h1><b +r><br>"; } else { # Do your stuff. $class->main($cgi,$user); }
"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.