Hi Lancelot,

some comments on your code:

On Tue, 13 Feb 2018 17:19:03 +0800
Lancelot Mak <lancelot....@computer.org> wrote:

> #!/usr/bin/perl -W
> 

1. don't use -w - http://perl-begin.org/tutorials/bad-elements/#the-dash-w-flag

2. use strict and warnings instead.

> use SSH::Command;
> 
> $cmdln = `grep $ARGV[0] list.txt`;
> chomp($cmdln);

use file i/o or IO-All or Path-Tiny instead of ``:
http://perl-begin.org/tutorials/bad-elements/#calling-the-shell-too-much

> ($cmdhost,$user,$pass) = split(':',$cmdln);
> $p = `echo $pass|base64 -d`;
> chomp($p);
> 

use https://metacpan.org/release/MIME-Base64 instead and avoid people snooping
on ps.
> $cmdlog = ssh_execute(
> host => $cmdhost,
> username => $user,
> password => $p,
> command => "$ARGV[1]",
> );
> 

See http://perl-begin.org/tutorials/bad-elements/#vars_in_quotes .

> 
> print $cmdlog;
> 
> print "\n";
> 
> 
> On 13 February 2018 at 16:36, Chas. Owens <chas.ow...@gmail.com> wrote:
> 
> > Can you simplify your code to a short program that had the issue and post
> > it? Often the act of shortening the program reveals the problem on its own.
> >
> > On Mon, Feb 12, 2018, 22:37 Lancelot Mak <lancelot....@gmail.com> wrote:
> >  
> >> Hi all,
> >>     I am using SSH::Command module to do ssh stuff but it does not return
> >> full reply from server. Any clue? It just returns part of it. Is it
> >> timeout? or what?
> >>     Thanks.
> >>
> >>
> >> --
> >> --
> >> Lancelot Mak
> >>  
> >  
> 
> 



-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://is.gd/htwEXQ - Integrating GNU Guile into GNU coreutils

Give me ASCII or give me deaþ!
    — http://www.shlomifish.org/humour.html

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to