test.pl
======
use Net::SSH::Perl;
    my $ssh = Net::SSH::Perl->new('10.217.2.117');
    $ssh->login('root', 'xxx);
    my($stdout, $stderr, $exit) = $ssh->cmd('uptime') or die "TIMED OUT";
    print $stdout;
    print $stderr;
    if ($@ = /TIMED OUT/)
    {
            print "not able to connect";
}

when i am running,

./test.pl
Permission denied at ./test.pl line 41

this is coming as password is wrong . What my requirement is how to trap the 
Permission denied in the script itself , so that i can use it and do some work 
around it.

Reply via email to