K
Keith
Hi, I'm a bit naive with both Perl and SSH, but I'm trying to write a
script that checks a bunch of Cisco devices to verify that it can log
into them via SSH. I installed Net::SSH:erl, and it is working well.
However, the source code of Net::SSH:erl makes several calls to die()
or croak() when it has any problems connecting such as not being able
to reach the host, bad password, etc. Some of the functions that do
this are _connect and _setup_connection. I don't want the program to
die when these things happen though; I just want my script to know that
it was unsuccessful (so it can log this into a database, for example)
and continue to run.
I've written my own versions of _connect and _setup_connection to
handle this; I just have the functions return -1 instead of croaking,
but my code is getting really ugly. Does anyone have any suggestions
on how to handle this? I'd appreciate the help.
script that checks a bunch of Cisco devices to verify that it can log
into them via SSH. I installed Net::SSH:erl, and it is working well.
However, the source code of Net::SSH:erl makes several calls to die()
or croak() when it has any problems connecting such as not being able
to reach the host, bad password, etc. Some of the functions that do
this are _connect and _setup_connection. I don't want the program to
die when these things happen though; I just want my script to know that
it was unsuccessful (so it can log this into a database, for example)
and continue to run.
I've written my own versions of _connect and _setup_connection to
handle this; I just have the functions return -1 instead of croaking,
but my code is getting really ugly. Does anyone have any suggestions
on how to handle this? I'd appreciate the help.