faro has asked for the wisdom of the Perl Monks concerning the following question:
Greetings monks. I have this piece of code:
I would like to put the modules loading dinamically:use My::AAA; use My::BBB; use My::CCC; my $module = 'My::' . $name_str; eval { $obj = $module->new(); }; if ($@) { print "Error loading module $module: $@\n"; exit; } $obj->login();
oreval { use "$module" };
Somehow i'm not getting this to work, any tips ? Thanks in advanceeval { require "$module" };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: use or require ?
by Corion (Patriarch) on Oct 01, 2007 at 08:51 UTC | |
Re: use or require ?
by jeanluca (Deacon) on Oct 01, 2007 at 09:01 UTC | |
by lima1 (Curate) on Oct 01, 2007 at 09:52 UTC | |
Re: use or require ?
by valdez (Monsignor) on Oct 01, 2007 at 12:37 UTC |
Back to
Seekers of Perl Wisdom