jbrugger has asked for the wisdom of the Perl Monks concerning the following question:
my $op = $query->param('option') || 'Login'; if ($op !~ /^[a-z0-9_]*$/i) { $op="NotAllowed"; } eval "require $op"; die "Couldn't find Class $op : ".$@."\n" if $@; $op->perform(...);
my $mods = {showOverview=>"showOverview", Login => "Login"} my $op = $mods->{$query->param('option')}; eval "require $op"; ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: better ways than eval to dynamic load a module
by crashtest (Curate) on Apr 17, 2005 at 19:32 UTC | |
by adamk (Chaplain) on Apr 18, 2005 at 03:32 UTC | |
|
Re: better ways than eval to dynamic load a module
by etcshadow (Priest) on Apr 17, 2005 at 21:02 UTC | |
|
Re: better ways than eval to dynamic load a module
by Tanktalus (Canon) on Apr 18, 2005 at 04:14 UTC | |
|
Re: better ways than eval to dynamic load a module
by jbrugger (Parson) on Apr 18, 2005 at 04:53 UTC | |
|
Re: better ways than eval to dynamic load a module
by cees (Curate) on Apr 18, 2005 at 04:00 UTC |