> > http://live.gnome.org/GTK2_2dPerl_2fFrequentlyAskedQuestions#head-3b88c68683fd189b09455a462d5e41669b7b1142
Thanks ! The FAQ however has some minor syntax errors. I found it being discussed here http://mail.gnome.org/archives/gtk-perl-list/2005-March/msg00107.html I tried the code that muppet has posted in that thread. Somehow that quite doesn't work for me either . I'm on windoze XP. I am wondering if it has anything to do with the fact that I'm on win32. The behaviour I notice is as follows. My textview buffer doesn't get anything written into it. My command prompt gets filled with "reading... read" messages (with no sleep in between) and it seems to be in an infinite loop. (no stopping after 9 seconds). Am I missing something here ? Does this have to do with buffering related to open(FILEHANDLE, EXPR). Here is the code that I'm running #!/usr/bin/perl -w use strict; use Gtk2 -init; my $window = Gtk2::Window->new; my $scroll = Gtk2::ScrolledWindow->new; my $textview = Gtk2::TextView->new; my $buffer = $textview->get_buffer; $window->add ($scroll); $scroll->add ($textview); $window->show_all; $window->signal_connect (destroy => sub { Gtk2->main_quit }); open(IN, q^perl -e '$|++; for $i (0..9) { $sum+= $i; print "Line $i: sum = $sum\n"; sleep 1;}'|^) or die "Failed running perl subprocess\n"; Glib::IO->add_watch ( fileno(IN), ['in', 'hup'], sub { my ($fileno, $condition) = @_; if ($condition eq 'hup') { warn "done\n"; close IN; return 0; # uninstall } warn "reading...\n"; my $line; sysread IN, $line, 1024; warn "read $line\n"; $buffer->insert($buffer->get_end_iter, $line); return 1; }); Gtk2->main; Thanks, _Ofey. _______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list