Re: capturing output from running process crashes gtk2



Ratcliffe, Jeffrey (Peters) wrote:
Use lexical filehandles (instead of oldstyle global ones), like so:

  my ($write, $read, $error);
  my $pid = open3($write, $read , $error, "./test_scan" );
  ...
  Glib::IO->add_watch(fileno($error), 'in', sub {
  ...
                              sysread $error, $line, 1024;

I get then:

Can't use an undefined value as a symbol reference at ./test_dialog3 line 48.

line 48 being the end of the add_watch sub.

Scalar filehandles would definitely be the way to go, but unfortunately,
open3() with scalar filehandles is buggy... it doesn't set $error properly.

http://rt.perl.org/rt3/Public/Bug/Display.html?id=31738

You might be able to work around it by predefining them as IO::Handle
objects, or something like that.

Mark



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]