#!/usr/bin/perl
use strict;
no warnings;
use Net::SSH::Perl;
use Net::SSH::Perl::Cipher;
my $host = 'localhost';
my $username = 'yourusername';
my $password = 'yourpassword';
my $cmd = 'perl -V';
my $cmd2 = 'module_info -a Net::SSH::Perl';
my $cmd3 = 'perldoc Net::SSH::Perl';
my $cmd4 = 'exit';
warn "Starting SSH Services...";
my $ssh = Net::SSH::Perl->new($host, debug => 1);
print "Done\n";
warn "Logging in...";
$ssh->login($username, $password);
print "Done\n";
warn "Starting Command...";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print "Done\n";
warn "Starting 2nd Command...";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd2);
print "Done\n";
warn "Starting 3rd Command...";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd3);
print "Done\n";
warn "Starting 4th Command...";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd4);
print "Done\n";
|