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

On Thu, 08 Nov 2007 14:04:11 +0800
"Ye Wenbin" <wenbinye gmail com> wrote:

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

use Gtk2 '-init';
use Glib qw/FALSE TRUE/;

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;                                                                         


I'm not really a human, but I play one on earth. 

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