in reply to Loading a module at runtime...
Eval-string is generally a bad idea for security reasons, assuming you're relying on data external to the program. This is just a way of minimising its use.if (defined $module) { # Detaint $module =~ m/^(My_Safe_Namespace(?:\:\:\w+)*)$/ or die "Unsafe module name: $module\n"; $module = $1; eval "use $1;"; die if $@; # Call 'run' as a method to avoid eval-string $module->run(); }
|
|---|