[Ssh-sftp-perl-users] Asynchronous Output
Brought to you by:
dbrobins
From: PUSHPARAJ B.S <pus...@ho...> - 2008-07-12 10:39:04
|
Hiclose STDOUT; close STDERR; $ssh=Net::SSH::Perl->new("113.128.160.214"); $ssh->login($UNM,$Pass); $cmd="ping 114.9.36.142"; $ssh->register_handler(SSH_SMSG_STDOUT_DATA,sub{($ssh,$packetout)=@_;push(@output,$packetout->get_str);$cache->set($session,[0,@output])}); ($stdout,$stderr,$exit)=$ssh->cmd($cmd); The above code connects to the machine using SSH and executes a ping command which asynchronously throws the output through the handler . The output is pushed into the array variable "@output" and this is printed . But I get to see only the first 2 lines of the output . What is wrong ? Moreover I would also like to print Standard error messages in the same output. How can I acheive this using the handler . Thanks Alfaromeo _________________________________________________________________ Searching for the best deals on travel? Visit MSN Travel. http://msn.coxandkings.co.in/cnk/cnk.do |