PerlRider has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I have some variables blessed with one Class. In one of the member functions of that Class, I created thread. I tried to access the Member variables directly from that Thread function as shown in the code below: I am unable to get the blessed variables data in the thread function. Can someone please let me know how to access them in thread function.
package PKG1; sub New { my($port, $ipadd) = @_; : : my $self = { ipaddress => $ipadd, port => $to_port, }; bless($self, $class); } sub Start { my ($self) = @_; my $tid = threads->new(\&threadFunc); $tid->join(); } sub threadFunc{ my($self) = @_; my($port, $ip); $ip = $self->{ipaddress}; $port = $self->{port}; } 1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to get Blessed variables of a Class in the Thread Function in Perl?
by NetWallah (Canon) on Jan 10, 2013 at 06:47 UTC | |
by PerlRider (Initiate) on Jan 10, 2013 at 08:26 UTC | |
Re: How to get Blessed variables of a Class in the Thread Function in Perl?
by vinoth.ree (Monsignor) on Jan 10, 2013 at 06:52 UTC |
Back to
Seekers of Perl Wisdom