Re: connecting to multiple hosts using Net::SSH2

2009-03-15 Thread Dan Wallis
On 09/03/2009, Jerald Sheets wrote: > to what was offered. When I get past leisurely using perl (I've been > "in the family" for about 8 months now) and get a chance to use it in > production more, I'm sure I'll be a little more familiar with the > various indentation styles and issues surroundi

Re: connecting to multiple hosts using Net::SSH2

2009-03-10 Thread monnappa appaiah
Hi All, I'm facing another problem: Below is the script to login to multiple hosts and then execute the command and give the ouput in text file This script will login to all the hosts in input.txt(this file contains around 137 hosts) but when i run the scriptits giving me outpu

Re: connecting to multiple hosts using Net::SSH2

2009-03-10 Thread Dermot
2009/3/9 : > Jerald Sheets wrote: >> >> On Mar 8, 2009, at 1:29 PM, Ron Bergin wrote: >> >>> On Mar 4, 4:46 am, que...@gmail.com (Jerald Sheets) wrote: I really think you're doing yourself a disservice by just throwing your program commands on lines, not indenting according to best

Re: connecting to multiple hosts using Net::SSH2

2009-03-10 Thread Dr.Ruud
Gunnar Hjalmarsson wrote: Dr.Ruud: Gunnar Hjalmarsson: Dr.Ruud: Gunnar Hjalmarsson: eval { $ssh2->connect($_) }; if ($@) { warn "Unable to connect host $_: $@" and next; } That is the "old fashioned" way. You really need to use the return value of eval to make sure.

Re: connecting to multiple hosts using Net::SSH2

2009-03-10 Thread Ron Bergin
On Mar 9, 3:37 am, que...@gmail.com (Jerald Sheets) wrote: > On Mar 8, 2009, at 1:29 PM, Ron Bergin wrote: > > > > >> #!/usr/bin/perl -w > > > It's better to use the warnings pragma, instead of the -w switch > > Another note on this... I just perldoc'ed it to see what it had to say: > > DESCRIPTIO

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread Dr.Ruud
Ron Bergin wrote: Jerald: #!/usr/bin/perl -w It's better to use the warnings pragma, instead of the -w switch And "-w" can also be better. For example when you want to enforce warnings to be active also for the used modules. (some module authors don't put a "use warnings;" in their modul

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread rkb
Jerald Sheets wrote: > > On Mar 8, 2009, at 1:29 PM, Ron Bergin wrote: > >> On Mar 4, 4:46 am, que...@gmail.com (Jerald Sheets) wrote: >>> >>> I really think you're doing yourself a disservice by just throwing >>> your program commands on lines, not indenting according to best >>> practices. It ma

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread Jerald Sheets
On Mar 8, 2009, at 1:29 PM, Ron Bergin wrote: #!/usr/bin/perl -w It's better to use the warnings pragma, instead of the -w switch Another note on this... I just perldoc'ed it to see what it had to say: DESCRIPTION The "warnings" pragma is a replacement for the command line f

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread Jerald Sheets
On Mar 8, 2009, at 1:29 PM, Ron Bergin wrote: On Mar 4, 4:46 am, que...@gmail.com (Jerald Sheets) wrote: I really think you're doing yourself a disservice by just throwing your program commands on lines, not indenting according to best practices. It makes your code unreadable, and can make i

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread Gunnar Hjalmarsson
Dr.Ruud wrote: Gunnar Hjalmarsson wrote: Dr.Ruud wrote: Gunnar Hjalmarsson wrote: eval { $ssh2->connect($_) }; if ($@) { warn "Unable to connect host $_: $@" and next; } That is the "old fashioned" way. You really need to use the return value of eval to make sure. I

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread Jerald Sheets
Thanks, Dr. R! Good to see you on the newbie list! I'm only about 6 months into this thing myself, but appreciate all you've done. --jms On Mar 9, 2009, at 5:10 AM, Dr.Ruud wrote: Gunnar Hjalmarsson wrote: Dr.Ruud wrote: Gunnar Hjalmarsson wrote: eval { $ssh2->connect($_) }; i

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread Dr.Ruud
Gunnar Hjalmarsson wrote: Dr.Ruud wrote: Gunnar Hjalmarsson wrote: eval { $ssh2->connect($_) }; if ($@) { warn "Unable to connect host $_: $@" and next; } That is the "old fashioned" way. You really need to use the return value of eval to make sure. I don't see anythi

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread Ron Bergin
On Mar 4, 4:46 am, que...@gmail.com (Jerald Sheets) wrote: > > I really think you're doing yourself a disservice by just throwing   > your program commands on lines, not indenting according to best   > practices.  It makes your code unreadable, and can make it very hard   > to debug the more involv

Re: connecting to multiple hosts using Net::SSH2

2009-03-08 Thread Gunnar Hjalmarsson
Dr.Ruud wrote: Gunnar Hjalmarsson wrote: monnappa appaiah wrote: This the error i'm getting Net::SSH2::connect: failed to connect to 10.10.10.1:22: Unknown error at connect.pl line 21 the line 21 is shown below $ssh2->connect($_) or warn "Unable to connect host $_\n" and next; It's appa

Re: connecting to multiple hosts using Net::SSH2

2009-03-08 Thread Dr.Ruud
Gunnar Hjalmarsson wrote: monnappa appaiah wrote: This the error i'm getting Net::SSH2::connect: failed to connect to 10.10.10.1:22: Unknown error at connect.pl line 21 the line 21 is shown below $ssh2->connect($_) or warn "Unable to connect host $_\n" and next; It's apparent that the fa

Re: connecting to multiple hosts using Net::SSH2

2009-03-06 Thread monnappa appaiah
Hi Gunnar, It worked, thanks a lot for helping out...thanks to all for helping Thanks, Monnappa On 3/5/09, Gunnar Hjalmarsson wrote: > monnappa appaiah wrote: >> This the error i'm getting >> >> Net::SSH2::connect: failed to connect to 10.10.10.1:22: Unknown error at >> co

Re: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread Gunnar Hjalmarsson
monnappa appaiah wrote: This the error i'm getting Net::SSH2::connect: failed to connect to 10.10.10.1:22: Unknown error at connect.pl line 21 the line 21 is shown below $ssh2->connect($_) or warn "Unable to connect host $_\n" and next; It's apparent that the fatal error happens inside Net:

Re: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread monnappa appaiah
Hi Dermot, This the error i'm getting Net::SSH2::connect: failed to connect to 10.10.10.1:22: Unknown error at connect.pl line 21 the line 21 is shown below $ssh2->connect($_) or warn "Unable to connect host $_\n" and next; Thanks, Monnappa On Wed, Mar 4, 2009 at 5:44 PM, D

Re: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread Jerald Sheets
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi there. My biggest comment isn't the answer to your question, but I will attempt to address that too. I really think you're doing yourself a disservice by just throwing your program commands on lines, not indenting according to best practic

Re: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread Dermot
2009/3/4 monnappa appaiah : > Hi, > >    I tried that warn(and next) still its not logging into the next > host...Kindly help me with this It's a bit hard to help without seeing the errors. Do you see the warn message? Are you sure that it fails because the host is unreachable or coul

Re: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread monnappa appaiah
Hi, I tried that warn(and next) still its not logging into the next host...Kindly help me with this Thanks, Monnappa On Wed, Mar 4, 2009 at 4:53 PM, Dermot wrote: > 2009/3/4 monnappa appaiah : > > Hi all, > Hi > > > Hi i'm able to connect to mulitple hosts now and it will log

Re: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread Dermot
2009/3/4 monnappa appaiah : > Hi all, Hi > Hi i'm able to connect to mulitple hosts now and it will login to all the > hosts specified in the input file (input.txt) > > if there is a host which doesn't exist in input file (input.txt), the > program ends without going to the next host in the file

Re: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread monnappa appaiah
Hi all, Hi i'm able to connect to mulitple hosts now and it will login to all the hosts specified in the input file (input.txt) if there is a host which doesn't exist in input file (input.txt), the program ends without going to the next host in the file for example: if the input.txt has three

Re: connecting to multiple hosts using Net::SSH2

2009-02-26 Thread Rob Dixon
monnappa appaiah wrote: > Hi all, > > > I'm using windows machine and i'm using Net::SSH2 module to connect > to remote machine > > below is the code i'm using, its working fine if i'm connecting to one host > > #!/usr/bin/perl -w > use strict; > use Net::SSH2; > > > my $ssh2 = Net::S

Re: connecting to multiple hosts using Net::SSH2

2009-02-26 Thread Jim Gibson
On 2/26/09 Thu Feb 26, 2009 8:26 AM, "monnappa appaiah" scribbled: > Hi all, > > > I'm using windows machine and i'm using Net::SSH2 module to connect > to remote machine > How can i use the same piece of code to read a list of hosts from a text > file and then connect to all the hos