Proclus has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use IO::Select; use IO::Handle; use Time::HiRes qw(usleep); $| =1 ; my $pingout ; open($pingout, '-|', "tracert www.google.com"); if($pingout){ my $select = IO::Select->new(); $select->add($pingout); while (1) { print "loop\n"; my $line; if (my @ready = $select->can_read(0) ) { foreach(@ready){ $_->sysread($line, 2048); print $line,$/; } } usleep(100000); # 100 ms } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: open,select,sysread for non-blocking traceroute
by ikegami (Patriarch) on Jun 02, 2009 at 17:39 UTC | |
by Proclus (Beadle) on Jun 02, 2009 at 18:59 UTC | |
by Anonymous Monk on Jun 02, 2009 at 19:07 UTC | |
by Proclus (Beadle) on Jun 02, 2009 at 20:01 UTC |