Sri Harsha has asked for the wisdom of the Perl Monks concerning the following question:
Consider I have two modules mod1.pm & mod2.pm. Based on a condition i would like use a module say,
#main script if($module) { use mod1; } else { use mod2; } test(); #mod1.pm sub test { print "Test"; } #mod2.pm sub test { print "Test1"; }
Even when the $module is true, it still invokes the "sub test" in mod2.pm:( Am I doing something wrong or this approach is not possible?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help in dynamically loading a module
by Corion (Patriarch) on Feb 15, 2012 at 08:15 UTC | |
|
Re: Need help in dynamically loading a module
by AnomalousMonk (Archbishop) on Feb 15, 2012 at 08:49 UTC | |
|
Re: Need help in dynamically loading a module
by philipbailey (Curate) on Feb 15, 2012 at 08:44 UTC | |
|
Re: Need help in dynamically loading a module
by locked_user sundialsvc4 (Abbot) on Feb 15, 2012 at 15:02 UTC |