Item Description: Making telnet with perl way too easy.
Net::Telnet is a very easy to use module for most tasks requiring telnet. It has an OO type interface that works very well for what I have used it for and it crosses platforms easily.
The MeatI haven't actually gone through the code enough to do a review on the actual code, but what I have seen is well written and easy to follow. There are extensive help pages that are also well written and easy to follow.
I have used this module successfully on both FreeBSD and Win2k with only one glitch (see below). I have used it with great success in child processes on FreeBSD as well as "compiled" it into a freestanding .exe for Win2k. Everything worked great "out of the box" and there was only one wrinkle to iron out.
I've used it connecting to several different devices including Cisco 2511 comm servers, Cisco switches and routers (CatOS and IOS), Foundry switches, Nokia IPXXX and Nokia CCXXX boxes. All worked great with the exception of a few tweaks required for the Cisco comm servers. I have also used it for Telnet access to FreeBSD machines for remote control purposes and it handles this very well.
Update: First, thanks to rob_au for the fix below and Second, I updated some of the text.
Update 2: There is a new version (3.03) of Net::Telnet on CPAN now and the author has *fixed* the issue above. I'm not sure if I like the fix (local $^W = '';), but it will now work without warnings. I did inform the author of the fixes below, however he may have reasons for discarding them and using his method. I don't know what that would be, but there may be something I'm not seeing.
Note: These bugs are in relation to the 3.02 version of this module.
I did find a couple things worth mentioning.
my $telnetObj = new Net::Telnet (Timeout => 20, Prompt => '/[^ <-]\>/' +, Errmode => "return") ; my $tmp = $^W ; local($^W) = 0; $telnetObj->open(Host => $gw_in_addr) ; #offending code in here $^W = $tmp;
It beats anything else out there. It has a great interface and I find it works much easier than expect for small jobs. The fact that it "compiles" into a freestanding .exe in Win2k, and works in child processes also attests to the stability in my mind.
If you need telnet...Net::Telnet is the only way to do it via perl.