Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^4: Need Help on Net::SSH2 Module Usage on Windows

by tarunmudgal4u (Sexton)
on Aug 22, 2012 at 12:19 UTC ( #989016=note: print w/replies, xml ) Need Help??

in reply to Re^3: Need Help on Net::SSH2 Module Usage on Windows
in thread Need Help on Net::SSH2 Module Usage on Windows

hi zentara.. thanks for your reply.. first of all, I want to make ssh from a windows machine to windows machine. So, here, I think, I can't run my commands in background. I tried one example using shell method you described but it was not working. It got stuck meanwhile executing it. Please see below snippet of code-

my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); if ($ssh2->connect($host)) { if ($ssh2->auth_password($user,$pass)) { #shell use print "connetced\n"; my $chan = $ssh2->channel() and print "channel created\n"; $chan->shell() and print "shell method called\n"; $chan->blocking(1) and print "blocking set ot 1\n"; $chan->write("dir\n") and print "dir fired\n"; select(undef,undef,undef,0.2) and print "select command fired\n" +; print $buf while ($len = $chan->read($buf,512)) > 0;
and the output of this program is-
C:\Compatibility_Automation_Temp>perl connetced libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type +, window_size, packet_size, ((void *)0) , 0 ) -> 0x1c70aec channel created shell method called blocking set ot 1 dir fired Net::SSH2::Channel::read(size = 512, ext = 0) ##here, this program stuck
Then I went through Net::SSH2::Channel module, but, there as well I didn't understand anything e.g.-
sub shell { $_[0]->process('shell') }
what is this subroutine doing? I didn't understand it as I didn't see any method named "process" specified there. Could you please give me an idea what I'm doing wrong and how can I move ahead with the better understanding of this module.

Replies are listed 'Best First'.
Re^5: Need Help on Net::SSH2 Module Usage on Windows
by zentara (Archbishop) on Aug 22, 2012 at 16:03 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989016]
[LanX]: I told you the story about the “new" currency trading system of Dresdner Bank
[LanX]: ?
[Corion]: No, or I don't remember the story ;)
LanX my favourite don't tell me the proof of concept is good enough for production anecdote
[ambrus]: ah, it's one of thos
[Eily]: what, there's a difference between proof of concept and production?
[LanX]: 20 years ago traders were complaining about the latency of the trading system...
[ambrus]: I'm currently in the process of rewriting my proof of concept programs. They sort of developped organically as I was experimenting, so now I've got an ugly mess of multiple programs and one-liners held together by nothing. I'll have to rewrite them to som
[ambrus]: ething that's both cleanly organized and mostly automated.
LanX in train, bad connection

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (15)
As of 2017-03-29 11:47 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (350 votes). Check out past polls.