input_add in infinite loop



I've gone through the archives in this list and I
think I even looked through all 300+ hits on google
for "input_add".  And I still can't find a way to keep
input_add from constantly calling my sub.  I know this
is an overly-simple piece of code, but I wanted to
make sure I could use the function before developing
more of my GUI.

I've seen examples where the sub uses input_remove,
but i want to keep looking for the next change in my
file even after finding one.

I'm reading a file as a workaround... I originally
wanted to monitor an table on a MySQL server.  So if
anyone knows a way to do that instead, that would be
preferable.

BTW, I'm using Perl 5.6.0 (from the Redhat 7.2 distro)
and the Gtk-Perl-0.7008-3 RPM from the same source.

I appreciate any thoughts.



#!/usr/bin/perl
# inputadd.plx

use warnings;
use strict;
use Gtk;
init Gtk;

my $updatelog = '/home/metuser/updatelog';

open (TMP, "$updatelog 2>&1 |");

my $id = Gtk::Gdk->input_add(fileno(TMP), 'read',
                               \&changed);
  
  main Gtk;

  sub changed {
        print "File changed\n";    
  }


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



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