lamp has asked for the wisdom of the Perl Monks concerning the following question:
While executing the command, i'm getting the following error#!/usr/bin/perl use Net::SSH::Expect; my $host = "testserver"; my $user = "test"; my $password = "pass"; my $ssh = Net::SSH::Expect->new ( host => $host, password=> $password, user => $user, raw_pty => 1, timeout => 10 ); my $login_output = $ssh->login(); my $cmd = qq(perl -e 'use ExtUtils::Installed; my ($inst) = ExtUtils:: +Installed->new(); my (@modules) = $inst->modules(); map { print $_ . +":" . $inst->version($_) ."\n"; }@modules;'); my $res = $ssh->exec($cmd); print($res); $ssh->close();
If I execute the command manually in remote server using SSH client, i'm getting the output.>new(); my () = ->modules(); map { print . ":" . ->version() ." > "; };' Can't declare stub in "my" at -e line 1, near ") =" syntax error at -e line 1, near "= ->modules" syntax error at -e line 1, near ". ->version" syntax error at -e line 2, near "};" (Might be a runaway multi-line "" string starting on line 1) Execution of -e aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error while executing a command using Net::SSH::Expect
by Corion (Patriarch) on Sep 09, 2008 at 08:01 UTC |