http://www.perlmonks.org?node_id=949985


in reply to Re^4: Need help with Perl multi threading
in thread Need help with Perl multi threading

So, you mean to say keep the thread that will do all like creating a SSH reference, calling function and what not for each server....?

No. I meant rather than create the Net::SSH::Expect object in the loop and then pass it into the thread, pass the information required to create the session into the thread create the session there.

However, whether that would actually work is predicated upon the module being thread safe and capable of handling concurrent sessions to different servers, which I strongly suspect is not the case, though I do not know for sure and cannot test it.

The bottom line is I do not think that you will be able to use threading and with Net::SSH::Expect. I would suggest that you contact the author and ask him if the module is thread-safe.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

  • Comment on Re^5: Need help with Perl multi threading

Replies are listed 'Best First'.
Re^6: Need help with Perl multi threading
by ashok.g (Beadle) on Jan 25, 2012 at 23:01 UTC
    I tried even that but still getting the segmentation fault.... all these trial are not working with Net::SSH::Expect and threads..... :-|
      . all these trial are not working with Net::SSH::Expect and threads.....

      That is what I suspected. I don't use a platform where Expect runs; nor do I have a handy list of machines I could SSH into, so there is nothing I can do to help you with this. Sorry.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        No worries. I am able to achieve my functionality by using Net::OpenSSH.

        Thank you Perl Monks for your help.

        Thanks,
        Ashok