Hello,

I have a directory named "Questionnaire" which contains some modules like "Files.pm", "MySQL.pm", and maybe others...

and I want to be able to choose the wanted module at runtime, using a code like:

my $module = "Files";

require Questionnaire::$module;
my $obj = Questionnaire::$module->new();

and of course, if I would offer another value for $module, like "MySQL", the program should use Questionnaire::MySQL instead.

First please tell me if this is a good practice, or I should better use

if ($module eq "Files") {
require Questionnaire::Files;
$obj = Questionnaire::Files->new();
}
elsif (...) {
...
}

Then please tell me how to do this... if it is possible.

Thank you.

Octavian


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to