trouble with reading from pipes



This may be a problem with my understanding of perl and not with GTK,
but here goes anyway.

In my program I create three pairs of pipes:

pipe($fractread,$fractwrite);
pipe($progread,$progwrite);
pipe($statusread,$statuswrite);

which I plan to use to get information from forked functions.

I also set up a watcher to notice when one of these pipes are written to
by the child process.

$tag = Gtk2::Helper->add_watch(fileno($fractread), 'in', \&setstatus);
sub setstatus{
      $progressbar->set_text(<$progread>);
      $progressbar->set_fraction(<$fractread>);
      Gtk2->main_iteration while Gtk2->events_pending;
      print "in status\n";
}

And finally in the child process I print to the pipe.
      print $fractwrite $count/$totaldays;
      print $statuswrite "Populating Database $count of $totaldays
".int($count/$totaldays*100)."%";

Only problem is that nothing ever happens, even though I know the child
process is running.  Any ideas what I am screwing up?

Dan




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