There's more than one way to do things | |
PerlMonks |
Net::Telnet - open session if not already openedby isaac737 (Initiate) |
on Sep 08, 2011 at 22:24 UTC ( [id://924963]=perlquestion: print w/replies, xml ) | Need Help?? |
isaac737 has asked for the wisdom of the Perl Monks concerning the following question: Hello Perl Monks, I have written a script that telnets into a series of routers every minute to collect some data and then it properly closes the session out. Well, it seems as though the routers' RPM doesn't like being telnetted to every minute and after a period of time the router is no longer able to allocate memory. We think it is because of the script and the fact that the code on the router is rather sucky. So, my question is how can I tell the Perl Net::Telnet module to *only* open a session if one is not open already. We would like to keep a session open all the time and just issue the command once a minute. The script would only open a new session if the existing one gets torn down for whatever reason. Here is what I have so far:
That works... what I guess I am after is some sort of if statement that says: if (Telnet Session is not open) { open session } else { proceed to rest of code } Any thoughts would be much appreciated. Thanks! -Jg
Back to
Seekers of Perl Wisdom
|
|