Hi all,
i need help in accessing the subroutines present in the perl scripts in perl modules.
getHosts() and getIP() subroutines are present in /tmp/utils/Utili.pl (perl script).
when i compile that master.pl, iam getting Undefined subroutine &Modules::test2::getIP called at /tmp/Modules/test2.pm
getIP() subroutine was present in the /tmp/utils/Utili.pl perl script.
i cannot take risk of changing /tmp/utils/Utili.pl to perl module, since it was used in hundreds of scripts and requires lot of testing effort.
could some one help me on this.?
please find the sudo code below.
Example:
master script: master.pl
in master.pl iam calling new subroutine in perl modules "test1.pm" and "test2.pm" as below.
use strict; use warnings; use lib "/tmp"; use Modules::test1; use Modules::test2; my $installation1 = Modules::test1->new(); my $installation2 = Modules::test2->new();
test1.pm:
in "test1.pm" i have the below code,
package Modules::test1; use strict; use warnings; require "/tmp/utils/Log.pl"; require "/tmp/utils/Utili.pl"; my @Hosts=getHosts(); sub new() { print "inside new\n"; }
test2.pm
in "test2.pm" i have the below code,
package Modules::test2; use strict; use warnings; my @IP=getIP(); require "/tmp/utils/Log.pl"; require "/tmp/utils/Utili.pl"; sub new() { print "inside new\n"; }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |