Enable strict and warnings and Perl itself will tell you that this is wrong:
my $thread = threads->create(\$self->_openFDCObject($swObject,$switch) +)
threads->create() requires a code reference as its first argument and you are passing a reference to the return value of a method call. (Which given that the method returns a list of two items, means I cannot actually guess what it is that you are passing to create(), but I do know you ought to be seeing an error message of the form:Thread 1 terminated abnormally: Not a CODE reference)
But before we get into how you might correct the syntax and semantics issues, why are you trying to run that method in a thread? How long does it take to create this new FosDataCapture() object?
Let me tell you that your threading "design" will not (ever) work as is, and for so many reasons that it is hard to know where to start. Your understanding of threads is either so limited or wrong that I really don't know how to begin to help you. But if you answer the above question first, we might get some where
In reply to Re: How do I used a threaded subroutine inside a perl object
by BrowserUk
in thread How do I used a threaded subroutine inside a perl object
by adamcpfeiffer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |