#!/usr/bin/perl -w
use strict;
use Gtk2 -init;
use IO::File;
use Glib  qw(TRUE FALSE);

my $fh = new IO::File;
my $pid = $fh->open ("./test.log");

Glib::IO->add_watch (fileno $fh, [qw/in/],
		                     \&watch_callback, $fh);	

Gtk2->main;

sub watch_callback {

	my ($fd, $condition, $fh) = @_;
	my @lines = $fh->getlines;
	print @lines;
	#always return TRUE to continue the callback
	return TRUE;
}