Perl Tk and Net issues

Discussion in 'Perl Misc' started by mcarthey@gmail.com, Sep 22, 2008.

  1. Guest

    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!
     
    , Sep 22, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,818
  2. Replies:
    23
    Views:
    252
    jthrumston
    Jan 9, 2006
  3. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Jan 23, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    309
    PerlFAQ Server
    Jan 23, 2011
  4. PerlFAQ Server
    Replies:
    0
    Views:
    697
    PerlFAQ Server
    Feb 3, 2011
  5. Dilbert
    Replies:
    0
    Views:
    846
    Dilbert
    Nov 10, 2011
Loading...

Share This Page