Re: Glib::IO::add_watch doesn't work in Windows

2008-11-02 Thread zentara
On Thu, 08 Nov 2007 14:04:11 +0800
Ye Wenbin [EMAIL PROTECTED] wrote:

Hi,
The add_watch function seem not work in Windows. I test using
this script:

use Gtk2 '-init';
use Glib qw/FALSE TRUE/;
Glib::IO-add_watch(
 fileno(STDIN),
 'in',
 \callback,
 \*STDIN,
);
Gtk2-main;

sub callback {
 my ($fd, $cond, $fh) = @_;
 my $line = $fh;
 print You just input $line\n;
 return FALSE;
}

The script works in Ubuntu.
But in windows, seem the program is block in the mainloop, and
all inputs will appear in the command line after I press Ctrl-C.

Sorry for the late reply, but I just happen to see this.
I don't use windows, but try readline instead of 

sub watch_callback {
  
#   print @_\n;   
  
my ($fd, $condition, $fh) = @_; 
  
my $line = readline STDIN;  
  
print $line;
  
#always return TRUE to continue the callback
  
return 1;   
  
}  


zentara

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/Remember_How_Lucky_You_Are.html 
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Glib::IO::add_watch doesn't work in Windows

2007-11-07 Thread Ye Wenbin
Hi,
The add_watch function seem not work in Windows. I test using
this script:

use Gtk2 '-init';
use Glib qw/FALSE TRUE/;
Glib::IO-add_watch(
 fileno(STDIN),
 'in',
 \callback,
 \*STDIN,
);
Gtk2-main;

sub callback {
 my ($fd, $cond, $fh) = @_;
 my $line = $fh;
 print You just input $line\n;
 return FALSE;
}

The script works in Ubuntu.
But in windows, seem the program is block in the mainloop, and
all inputs will appear in the command line after I press Ctrl-C.

-- 
Best regards.
Ye Wenbin
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list