Mar 19, 2009

Activeperl ssh

Activeperl , type ppm to explore Perl Package Manager ,
search net-ssh-perl , if cannot find , then edit the preference , add other repository.

Choose mark for install , you will find warning message .
Install all of it before install net-ssh-perl.

And then comment out line 216 at 'dir'\net\ssh\perl.pm
# defined($sock->blocking(0))
# or die "Can't set socket non-blocking: $!";

then can try following ssh test script.

use Net::SSH::Perl ;
my $ssh = Net::SSH::Perl->new("192.168.1.1");
$ssh->login("root", "bbb");
my($stdout,$stderr,$exit)=$ssh -> cmd("ls");
print $stdout;

0 意見: