in reply to Re: Telnet & Text Capture to file
in thread Telnet & Text Capture to file

Sorry Corion ... not used to the chatterbox yet. I cannot use ssh or rsh, as this is a straight telnet session to a closed source system. I understand that I can use Net::Telnet or IO:Socket. It is the 'text capture' part that has me stumped (very new to perl - sorry). I only need to start the capture when I issue the command to start the report, then turn it off and write to the file, after the report is complete. Will either of the two mods you mentioned above also handle this capture or is there something else I will need? Thank you.

Replies are listed 'Best First'.
Re^3: Telnet & Text Capture to file
by Corion (Patriarch) on Jul 15, 2009 at 20:42 UTC

    The Net::Telnet documentation, especially its synopsis shows the following code:

    use Net::Telnet (); $t = new Net::Telnet (Timeout => 10, Prompt => '/bash\$ $/'); $t->open("sparky"); $t->login($username, $passwd); @lines = $t->cmd("who"); print @lines;

    I interpret this code as

    1. logging on to a machine "sparky", with a username of $username and a corresponding password
    2. executing a command, who, and capturing its output in @output
    3. printing the captured output

    I'm not sure where the synopsis of Net::Telnet diverges from your stated requirements, or where you've found flaws in the operation of Net::Telnet for your required operation, so I can't help you much further. If you have problems with writing the lines captured in @output to a file, consider looking at open and print, but neither of these have anything to do with a telnet connection.

      Thank you. I will use the Net::Telnet.