Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^6: Urgent Help For Perl Issues

by salva (Abbot)
on Mar 15, 2013 at 10:27 UTC ( #1023658=note: print w/replies, xml ) Need Help??

in reply to Re^5: Urgent Help For Perl Issues
in thread Urgent Help For Perl Issues

ssh opens a new session for every command run and so commands with side effects as cd doesn't work as expected.

Use shell conjunctions instead to run the two commands as one:

$ssh->cmd("cd $dir && $cmd")

Replies are listed 'Best First'.
Re^7: Urgent Help For Perl Issues
by arvindninestars (Initiate) on Mar 18, 2013 at 07:20 UTC
    No Luck salva..Any Other ideas..
      yes, post your code, otherwise nobody is going to guess what you are doing wrong!
        Two Different Codes i Posted here...Please check...
        #!/usr/bin/perl #use strict; #use warnings; use Net::SSH::Perl; my $host = "XXXX"; my $user = "XXXX"; my $password = "XXXX"; my $path = "/XXXX"; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $password); my($stdout, $stderr, $exit) = $ssh->cmd("cd $path"); ($stdout, $stderr, $exit) = $ssh->cmd("tar -xvzf XXXX.tar.gz");
        #!/usr/bin/perl #use strict; #use warnings; use Net::SSH::Perl; my $host = "XXXX"; my $user = "XXXX"; my $password = "XXXX"; my $path = "/XXXX"; my $cmd = "tar -xvzf XXXX.tar.gz"; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $password); my($stdout, $stderr, $exit) = $ssh->cmd("cd $path && $cmd");

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023658]
[Perl300]: ok, thank you Corion
[Perl300]: I was researching few modules and was not sure about what that date indicates

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2017-12-11 18:07 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (310 votes). Check out past polls.