MKJ747 has asked for the wisdom of the Perl Monks concerning the following question:
I am attempting to control a third party program using PERL via Net::Telnet in a Windows environment. I have successfully scripted logging onto the server and running some rudimentary commands. However, when I run a certain program, I'm getting unexpected results and I can't identify the problem using the debug tools/methods covered on the author's page on CPAN (e.g., examing the log file, using waitfor instead of cmd, etc., i.e., the problem is not a time out issue). I believe it might be related to raw data that is generated from the program (the visual screen output in this program shows the prompts in bold, and the input fields are highlighted). The first prompt in the program asks for an output file location. I successfully send the path, and an empty file gets created in that location. The next prompt asks for a description. The problem is this prompt never shows up in the output flow as seen in the log file generated by dump_log (so the use of cmd or waitfor to enter the next input doesn't work since the prompt never appears). It appears as if the connection is dropped at this point (see data output below). After the prompt for the file location is sent, there is some garbage characters and spaces returned that is the raw data. After that, I send the file name back. I know the program accepts the file name because a zero length file is created in the output location, but this is the last output received from the terminal in the logfile. Here's the log file output:
< 0x000a0: 30 6d 1b 5b 34 3b 31 48 1b 5b 4b 1b 5b 30 6d 46 0m.[4;1 +H.[K.[0mF < 0x000b0: 69 6c 65 3a 1b 5b 30 3b 37 6d 1b 5b 34 3b 37 48 ile:#fi +le prompt is here#.[0;7m.[4;7H < 0x000c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + < 0x000d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + < 0x000e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + < 0x000f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + < 0x00100: 20 20 20 20 20 20 20 20 1b 5b 34 3b 37 48 + .[4;7H > 0x00000: 66 69 6c 65 0d 0a file..# +file sent is here (just the name "file"#
After that, PERL sends the rest of the commands (there are some Y/N prompts that I respond to with print) and the script completes without error, but the file remains at zero length (it behaves as if the connection is lost as soon as I send the file path). If I enter the exact same information manually through telnet, it works fine. I was hoping someone here could give me some guidance on additional debugging techniques I could use to trouble shoot this issue, or if there are any ways to eliminate the raw data being sent from the terminal (I have tried cmd_remove_mode and turning off telnet_mode without any apparent difference). Thank you.
|
|---|