Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

duplicately named methods in 2 modules how do i differentiate

Status
Not open for further replies.

damonh78

Programmer
Jul 28, 2005
44
IE
Hi,

I am importing 2 modules OrbixTest.pm (resides in /lib/perl) and NamesTest.pm (resides in /Names/lib/perl) using the line:
#!/usr/bin/perl -I/lib/perl -I/Names/lib/perl

I have discovered that both modules contain a package called TestRun and a function called new in the package that I need to use. The implementation of the functions in the 2 packages are different

The function is called in the OrbixTest.pm cause using:
my $testRun = new TestRun($testLog, $autobuild);

and in NamesTest.pm
my $testRun = new TestRun($testLog);

I have just discovered that everytime either of the above lines are called the function in the package in OrbixTest.pm is being invoked.
I need a way to differentiate which module I want to invoke. I was thinking that I can probably use namespaces to do this how would I go about doing this or how should I do it?

Thanks,

John
 
Have you tried OrbixTest::TestRun, and NamesTest::TestRun? This is officially a straw clutch ;-s

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Unfortunately that doesnt seem to work I can get an error telling me that
:
it's cant locate the object method new via Package NamesTest::TestRun

Cheers anyway,

John
 
How big are the modules, you could rename one of the routines and rename the relevant references, do they do the same thing, or use different paramaters?

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
modules arent too big, but I would then have to change all other scripts that use the module, which I would prefer not too do, so I was hoping that there is a way of differentiating between the two.
 
If each module contains constructors do this
Code:
my $module1 = OrbixTest->new;
my $module2 = NamesTest->new;

$module1->TestRun();
$module2->TestRun();

M. Brooks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top