V
vabby
My problem scenario is as follows.
I have a module BatLib1.pm and another module BatLib2.pm and a main
perl module mod_main.pl . Inside BatLib2.pm, there is a function fn1()
, where I declare and define an array like this:
$self->{array_test}[0] = 0;
$self->{array_test}[1] = 1;
$self->{array_test}[2] = 2;
INside mod_main.pl , I create a new instance of Batlib2,
$batlibobj2 = new_Batlib2 Batlib2();
and then a new instance of Batlib1, where I pass as arg the instance of
Batlib2
$batlibobj1 = new_Batlib1 Batlib1($batlibobj2);
Inside Batlib1.pm
I make a call to Batlib2::fn1() and it works so that the array_test
gets populated. Now I have to access this array in Batlib1. How can I
do it:
I tried using $self->{batlibobj2}->{array_test}, but it doesnot work.
Plz note that batlibobj2 is a member variable of Batlib1 which gets
intilaized in the new_Batlib1 function.
Tx
Vabby
I have a module BatLib1.pm and another module BatLib2.pm and a main
perl module mod_main.pl . Inside BatLib2.pm, there is a function fn1()
, where I declare and define an array like this:
$self->{array_test}[0] = 0;
$self->{array_test}[1] = 1;
$self->{array_test}[2] = 2;
INside mod_main.pl , I create a new instance of Batlib2,
$batlibobj2 = new_Batlib2 Batlib2();
and then a new instance of Batlib1, where I pass as arg the instance of
Batlib2
$batlibobj1 = new_Batlib1 Batlib1($batlibobj2);
Inside Batlib1.pm
I make a call to Batlib2::fn1() and it works so that the array_test
gets populated. Now I have to access this array in Batlib1. How can I
do it:
I tried using $self->{batlibobj2}->{array_test}, but it doesnot work.
Plz note that batlibobj2 is a member variable of Batlib1 which gets
intilaized in the new_Batlib1 function.
Tx
Vabby