RE: capturing output from running process crashes gtk2

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.

As for the problem with the real scanimage program mentioned by zentara:

Thanks for the tips. Noted!


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