Perl Tk and Net issues

M

mcarthey

I am having problems capturing the output from a cmd when using
Net::Telnet. I have been able to use both cmd() and the print() and
waitfor() combo, but with varying results.
I have done something like the following (please consider this a sort
of perl psuedo-code because I don't have my source in front of me)

$trm = new Net::Telnet
@output = $trm->cmd($cmd);
$txt->insert( 'end', @output ); #using Perl Tk

At this point, the text window does not completely display the output.
It only displays a few lines of the output (which is from a 'ps'
command, by the way). The strange thing is that if I loop through the
output and display one line at a time then all the lines are there.

I have tried to use the combo of print() and waitfor() to send the
command and capture the output as well. This results in the text
window displaying the contents properly, but I lose the ability to
parse the output line-by-line because all lines of the output are in a
single string. I thought that perhaps I could break the multi-line
"scalar" into an array by splitting on /\n/ but it strangely wasn't
working.
If it matters, I am running the Perl script from ActivePerl on Windows
XP and connecting to a OSF1 Alpha box.

I'd appreciate some insight into this problem as it's driving me
crazy. I don't know if it's a limitation in how Net::Telnet builds the
output or a limitation in how Tk creates the text window.

Thanks much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top