Net::Telnet and Tk prevent Perl from returning system commands on Windows

Discussion in 'Perl Misc' started by Alex Gorbachev, Jan 2, 2007.

  1. This reduced version of my code fails in line 13 ( for (1..5) {system ("echo
    syscall $_")}) -- Perl cannot close the system call. Running this with Perl
    5.8.8 on Win XP and Win 2000 with same result.


    use Tk;
    use Net::Telnet;

    $main = MainWindow->new;

    $main->Button( -text => DO,-command => (sub{do_work()}))->pack(qw/-pady
    15 -padx 20/);
    MainLoop;

    sub do_work {
    my $t = new Net::Telnet (Port => 25);
    $t->open("yahoo.com") or print "Cannot connect";
    $t->close;
    for (1..5) {system ("echo syscall $_")}
    }
    Alex Gorbachev, Jan 2, 2007
    #1
    1. Advertising

  2. Unfortunately no improvement. It seems something in the code of Net::Telnet
    is interfering with Perl core in combination with Tk, not the telnet process
    itself. One thing to note that this problem (system call not ever returning
    back to Perl) happens when the button is pressed (or via some other event in
    Tk).


    "Petr Vileta" <> wrote in message
    news:ene5hn$2skl$...
    > "Alex Gorbachev" <> píše v diskusním pøíspìvku
    > news:...
    >> This reduced version of my code fails in line 13 ( for (1..5) {system
    >> ("echo
    >> syscall $_")}) -- Perl cannot close the system call. Running this with
    >> Perl
    >> 5.8.8 on Win XP and Win 2000 with same result.
    >>
    >>
    >> use Tk;
    >> use Net::Telnet;
    >>
    >> $main = MainWindow->new;
    >>
    >> $main->Button( -text => DO,-command => (sub{do_work()}))->pack(qw/-pady
    >> 15 -padx 20/);
    >> MainLoop;
    >>
    >> sub do_work {
    >> my $t = new Net::Telnet (Port => 25);
    >> $t->open("yahoo.com") or print "Cannot connect";

    >
    > # maybe this can help you
    > $t->break;
    > $t->print('bye');
    >
    >> $t->close;
    >> for (1..5) {system ("echo syscall $_")}
    >> }
    >>

    >
    Alex Gorbachev, Jan 2, 2007
    #2
    1. Advertising

  3. FYI, ActiveState logged a bug on this, the bug can be tracked at

    http://bugs.activestate.com/show_bug.cgi?id=65304

    "Marc Dashevsky" <> wrote in message
    news:...
    > In article <>,
    > says...
    >> Unfortunately no improvement. It seems something in the code of
    >> Net::Telnet
    >> is interfering with Perl core in combination with Tk, not the telnet
    >> process
    >> itself. One thing to note that this problem (system call not ever
    >> returning
    >> back to Perl) happens when the button is pressed (or via some other event
    >> in
    >> Tk).

    >
    > Maybe it uses threads?
    >
    > --
    > Go to http://MarcDashevsky.com to send me e-mail.
    Alex Gorbachev, Jan 2, 2007
    #3
    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. Replies:
    5
    Views:
    13,291
  2. Zach Flynn
    Replies:
    2
    Views:
    3,325
    Alan Johnson
    Jun 5, 2005
  3. Jim Isaacson
    Replies:
    5
    Views:
    603
    Default User
    Nov 5, 2004
  4. Carcarius
    Replies:
    0
    Views:
    294
    Carcarius
    Dec 6, 2007
  5. John A. Van Walleghen

    Net::Telnet and Xyplex - Can't get output from commands

    John A. Van Walleghen, Feb 23, 2004, in forum: Perl Misc
    Replies:
    2
    Views:
    167
    John A. Van Walleghen
    Feb 24, 2004
Loading...

Share This Page