arwillia has asked for the wisdom of the Perl Monks concerning the following question:

Winodws 2008 64-bit running Strawberry Perl connecting to SuSe Linux 11 I can not get past this error Can't call method "blocking " on an undifined vaule Any method call is not working eg exec..etc

#!D:\SupportTools\perl\perl\bin\perl -w use strict; use Net::SSH2; use MIME::Base64; my $ssh2 = Net::SSH2->new(); $ssh2->connect("servername") or die "Unable to connect host $@ \n"; $ssh2->auth_password('user','passwd'); my $chan = $ssh2->channel(); $chan->blocking(); $chan->exec('ls'); my $buflen = 10000; my $buf1 = '0' x $buflen; $chan->read($buf1, $buflen); #print "BUF1:\n", $buf1,"\n"; $chan->exec('exit'); $ssh2->disconnect();

Replies are listed 'Best First'.
Re: Bangging head against desk
by Khen1950fx (Canon) on Jan 18, 2012 at 02:20 UTC
    Try Net::OpenSSH::Compat::SSH2 by salva. It's easier on your head and on your desk.
    #!perl use strict; use warnings; use Net::OpenSSH::Compat::SSH2; use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('host') or die "Unable to connect to host: $!\n"; $ssh2->auth_password('user', 'password'); my $chan = $ssh2->channel(); $chan->exec("ls"); print while <$chan>; $chan->close; $ssh2->disconnect();
Re: Bangging head against desk
by choroba (Cardinal) on Jan 18, 2012 at 17:04 UTC
    You might consider changing the title of your post to something more suitable for searching.