in reply to Re^7: Dependences to install Net::SSH2 for windows
in thread Dependences to install Net::SSH2 for windows

Hi Rob,
Thanks for your great help, yes what you told is right,i am able to install from http://members.optusnet.com.au/~sisyphus1/ppms/Net-SSH2-56.ppd
but if i am testing with simple code
#!/usr/bin/perl use warnings; use strict; use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('$hostname') or die "Unable to connect Host $@ \n"; $ssh2->auth_password('veeru','143') or die "Unable to login $@ \n"; my $chan2 = $ssh2->channel(); $chan2->shell(); print $chan2 "cd /home/john"; print "LINE : $_" while <$chan2>; print $chan2 "pwd\n"; print "LINE : $_" while <$chan2>; print $chan2 "ls -lrt \n"; print "LINE : $_" while <$chan2>;
iam getting errors like :
print() on unopened filehandle Net::SSH2::Channel::_GEN_0 at testex.pl line 14.
readline() on unopened filehandle Net::SSH2::Channel::_GEN_0 at testex.pl line 15
print() on unopened filehandle Net::SSH2::Channel::_GEN_0 at testex.pl line 16.
readline() on unopened filehandle Net::SSH2::Channel::_GEN_0 at testex.pl line 17
print() on unopened filehandle Net::SSH2::Channel::_GEN_0 at testex.pl line 19.
readline() on unopened filehandle Net::SSH2::Channel::_GEN_0 at testex.pl line 20

Replies are listed 'Best First'.
Re^9: Dependences to install Net::SSH2 for windows
by syphilis (Archbishop) on Nov 07, 2006 at 07:05 UTC
    And the exact same script runs fine on linux ? If so, then I guess the problem is either the fact that you're using perl 5.6 or the fact that you're using Windows. Afaik, I don't have any access to a secure shell server, so I'm unable to personally test things properly.

    One thing you could try is to grab the Net-SSH2-0.09 test script from cpan (http://search.cpan.org/src/DBROBINS/Net-SSH2-0.09/t/Net-SSH2.t) and give it a run. The first 11 tests should pass ... beyond that I don't really know. Perhaps it might help. But I think the best thing to do would be to update your Windows to perl 5.8.8 and try out Net-SSH2 on that.

    If you haven't already, check the Net::SSH::Channel documentation - there might be something in there that helps.

    Cheers,
    Rob

    Update: And how about the example script at http://search.cpan.org/src/DBROBINS/Net-SSH2-0.09/example/read.pl ... does it work for you ?
      Hi Rob,
      i updated my perl version 5.8.8
      i instlled Net::SSH2
      ppm install http://members.optusnet.com.au/~sisyphus1/ppms/Net-SSH2.ppd
      if iam giving code
      use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('$hostname') or die "Unable to connect Host $@ \n"; $ssh2->auth_password('ann134','$pass') or die "Unable to login $@ \n"; my $chan2 = $ssh2->channel(); $chan2->shell(); print $chan2 "ls -lrt\n"; print "LINE : $_" while <$chan2>; $chan2->close;
      iam unable to see any out put