in reply to calling functions with same names but in different modules depending on user input
ROTFLMAO!
Sorry... not laughing at you, I was laughing at
myself. I dowloaded your code and replaced the psuedocode
with real code and boggled at why I kept getting errors
to the effect of:
and then it dawned on me what was going on.Undefined subroutine &B::just_print called at index.pl line 8.
When you are doing a use B; you are pulling in the B perl compiler and not getting the expected results. Anyway....
I modified your example and came up with the following:
and# The main code: use A; use Blooper; foreach (0..1){ A::just_print("hi") if $_; B::just_print("hello") if not $_; } sub main_print(){ print @_; }
and#A.pm package A; sub just_print{ print @_; main::main_print(); } 1;
and when the code is run I get:#Blooper.pm package B; sub just_print { print @_; main::main_print(); } 1;
as I would expect.hellohi
With all that in mind... what did you get for errors?
|
|---|