in reply to How do I used a threaded subroutine inside a perl object
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I used a threaded subroutine inside a perl object
by adamcpfeiffer (Novice) on Jul 03, 2013 at 12:27 UTC | |
by BrowserUk (Patriarch) on Jul 03, 2013 at 13:45 UTC | |
by adamcpfeiffer (Novice) on Jul 03, 2013 at 16:37 UTC | |
by BrowserUk (Patriarch) on Jul 03, 2013 at 18:00 UTC |