in reply to Any event modules that support STDIN polling for Windows?
#!/usr/bin/perl use warnings; use strict; use Glib; my $main_loop = Glib::MainLoop->new; Glib::IO->add_watch (fileno 'STDIN', [qw/in/], \&watch_callback, 'STDI +N'); #just to show it's non blocking my $timer1 = Glib::Timeout->add (1000, \&testcallback, undef, 1 ); $main_loop->run; sub watch_callback { # print "@_\n"; my ($fd, $condition, $fh) = @_; my $line = readline STDIN; print $line; #always return TRUE to continue the callback return 1; } sub testcallback{ print "\t\t\t".time."\n"; } __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Any event modules that support STDIN polling for Windows?
by KHLeow (Novice) on Aug 30, 2010 at 08:44 UTC | |
by zentara (Cardinal) on Aug 30, 2010 at 10:26 UTC | |
by KHLeow (Novice) on Aug 30, 2010 at 18:11 UTC | |
by zentara (Cardinal) on Aug 30, 2010 at 18:19 UTC | |
by KHLeow (Novice) on Aug 30, 2010 at 19:03 UTC |