in reply to Perl/Tk problem on Windows

Try
$mw->destroy; CORE::exit();
instead of just exit. exit() in conjuction with Tk is evil in forked or threaded environemnts.

Replies are listed 'Best First'.
Re^2: Perl/Tk problem on Windows
by nr0mx (Scribe) on Jun 03, 2004 at 10:16 UTC
    Tried this. It still don't work. Am I missing something fundamental ? I tried changing the code to the below version, but to the same end.
    sub client_connect { my ( $ns, $from ) = @_; chomp($_=<$ns>); print "$from : $_\n"; my $mw = MainWindow->new(); my $t= $mw->Scrolled('Text'); $t->pack(-expand => 1, -fill => 'both' ); tie ( *TEXT, 'Tk::Text', $t ); print TEXT "$from\n\n$_\n"; $mw->destroy; close $ns; CORE::exit(); }
      Are you using fork or threads?
        I'm using fork.
        while ( my $ns = $server->accept ) { ... if ( my $pid = fork ) { close $ns or die "Client socket close failed. [$!]\n"; } elsif (defined $pid) { $ns->autoflush(1); client_connect $ns,$from; } else { die "fork error. [$!]\n"; } }