in reply to SSH2 - Asynchronous Opens & Synchronous Commands
I'd need a way of sharing the Control::CLI (i.e. Net::SSH2) object instead of having it copied to the children (threads::shared does not appear to support the Net::SSH2/Control::CLI object). I've also read here that it may be an SSH security violation to have the parent and its child thread both access the same session. If someone knows a way to do this with ithreads, I'd love to understand how it can be done. :)
Try:
use threads; use threads::shared qw[ shared_clone ]; my @sessionData = ...; my @ssh2_handles :shared; sub opener { my( $idx, ... ) = @_; use Net::SSH2; my $ssh = Net::SSH2->new( .. ); lock @ssh2_handles; $ssh2_handles[ $idx ] = shared_clone( $ssh ); return; } my $idx = 0; my @openers = async( \&opener, $idx++, $_ ) for @sessionData; $_->join for @openers; ### use @ssh2_handles here...
This is untested, untried, speculation -- I don't have facilities to do so -- but the basic premise is sound.
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: SSH2 - Asynchronous Opens & Synchronous Commands
by 5haun (Scribe) on Apr 04, 2014 at 23:09 UTC | |
Re^2: SSH2 - Asynchronous Opens & Synchronous Commands
by 5haun (Scribe) on Apr 04, 2014 at 13:53 UTC | |
Re^2: SSH2 - Asynchronous Opens & Synchronous Commands
by 5haun (Scribe) on Apr 05, 2014 at 02:18 UTC | |
by BrowserUk (Patriarch) on Apr 05, 2014 at 08:54 UTC | |
by 5haun (Scribe) on Apr 05, 2014 at 15:02 UTC | |
by BrowserUk (Patriarch) on Apr 05, 2014 at 15:20 UTC |
In Section
Seekers of Perl Wisdom