Help with calling modules 
Author Message
 Help with calling modules

Hi, thanks in advanced to who ever can help :

    I am writing a perl script for creating web site semi-automatically.
I have encountered a problem of calling two modules with same sub
function name but performs differently.

    For example, there are Module_A and Module_B with the same name sub
function_C. The reason of having the same name function_C is because it
is needed to be called in main Perl script. When both Modules are
already required and the current mode is in Module A, when ever the sub
function in Module B is needed, the Perl script only call the one in
Module A in stead of B.

Does anyone know to recall the same sub-funtion name in different
Module  by main script ? I'll be deeply appreciated any light given for
this problem.



Thu, 19 Apr 2001 03:00:00 GMT  
 Help with calling modules
[posted & mailed]


:     For example, there are Module_A and Module_B with the same name sub
: function_C. The reason of having the same name function_C is because it
: is needed to be called in main Perl script. When both Modules are
: already required and the current mode is in Module A, when ever the sub
: function in Module B is needed, the Perl script only call the one in
: Module A in stead of B.
:
: Does anyone know to recall the same sub-funtion name in different
: Module  by main script ? I'll be deeply appreciated any light given for
: this problem.

        Don't import both names, just fully qualify them:

        use Module_A ();
        use Module_B ():

        Module_A::someFunction();
        Module_B::someFunction();

--

BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".



Thu, 19 Apr 2001 03:00:00 GMT  
 Help with calling modules
Name it explicitly:

&Module_B::function_C or &Module_A::function_C

and don't export function_C automaticaly neither
from Module_A nor Module_B.

OR

make both module OO...

HIH (hope it helps)

Quote:

> Hi, thanks in advanced to who ever can help :

>     I am writing a perl script for creating web site semi-automatically.
> I have encountered a problem of calling two modules with same sub
> function name but performs differently.

>     For example, there are Module_A and Module_B with the same name sub
> function_C. The reason of having the same name function_C is because it
> is needed to be called in main Perl script. When both Modules are
> already required and the current mode is in Module A, when ever the sub
> function in Module B is needed, the Perl script only call the one in
> Module A in stead of B.

> Does anyone know to recall the same sub-funtion name in different
> Module  by main script ? I'll be deeply appreciated any light given for
> this problem.



Thu, 19 Apr 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help with calling modules

2. HELP HELP HELP!!! - with function call parameters

3. How to build single debug call for module?

4. Pre-announce: New module called FSM::Command

5. .xs module makes library calls take forever!

6. XS module calling C++ function

7. Error 502 calling Modules

8. What to call a module for HPUX's getprpwent, getprpwuid,

9. Using packages/modules when calling program from another directory

10. PDF::Core::PDFGetPrimitive() called too early - PDF perl module problem

11. Perl module equivalent for C hostname() call?

12. Calling a sub rutine in another package or module

 

 
Powered by phpBB® Forum Software