Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How to get Blessed variables of a Class in the Thread Function in Perl?

by NetWallah (Abbot)
on Jan 10, 2013 at 06:47 UTC ( #1012599=note: print w/ replies, xml ) Need Help??


in reply to How to get Blessed variables of a Class in the Thread Function in Perl?

That is because you neglected to pass $self as a parameter to the threaded call to threadFunc.

Try:

my $tid = threads->new(\&threadFunc , $self); # Syntax: $thr = threads +->create(FUNCTION, ARGS)

             "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius


Comment on Re: How to get Blessed variables of a Class in the Thread Function in Perl?
Download Code
Replies are listed 'Best First'.
Re^2: How to get Blessed variables of a Class in the Thread Function in Perl?
by PerlRider (Initiate) on Jan 10, 2013 at 08:26 UTC

    Thanks all, I thought as normal member function and henc didnot give $self as an argument. Working fine after passing $self as argument.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012599]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-07-08 03:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls