geckosan has asked for the wisdom of the Perl Monks concerning the following question:
I have two modules, interface1.pm and interface2.pm. They contain different sets of functions with the same names. Is there any way I can use both of them, and call the function I want by name, the module it uses being dependant on a variable?
For example, if I call the function terraform which is described in both interfaces and the variable $version is 1, then the interface1.pm version of terraform will be used. If version was 2, interface2.pm would be used.
That's what I'd like. Of course I'm noticing I can't load the two sets of functions without them overwriting each other, even if I say:
I was hoping I could do that, and then use a combination of use and no when I wanted to switch "versions" in the program. But no, foiled at the outset.use interface1 (); use interface2 ();
I might be approaching this improperly, if so please nudge me in the right direction.
Thanks a lot!
GrandFather altered the title. Title was versioning
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Calling same named functions from different modules
by Tanktalus (Canon) on Oct 25, 2005 at 04:17 UTC | |
|
Re: Calling same named functions from different modules
by holli (Abbot) on Oct 25, 2005 at 07:05 UTC | |
| |
|
Re: Calling same named functions from different modules
by Zaxo (Archbishop) on Oct 25, 2005 at 05:02 UTC | |
|
Re: Calling same named functions from different modules
by sauoq (Abbot) on Oct 25, 2005 at 12:48 UTC |