Re: Sleeping for less than a second
On May 30, Craig Moynes/Markham/IBM said: Is there anyway to sleep for less than a second using the default installation of perl ? friday:~ $ perldoc -q sleep =head1 Found in /usr/local/lib/perl5/5.00502/pod/perlfaq8.pod =head2 How can I sleep() or alarm() for under a second? If you want finer granularity than the 1 second that the sleep() function provides, the easiest way is to use the select() function as documented in Lperlfunc/select. If your system has itimers and syscall() support, you can check out the old example in http://www.perl.com/CPAN/doc/misc/ancient/tutorial/eg/itimers.pl . I refer you then to perlfunc: friday:~ $ perldoc -f select [...] You can effect a sleep of 250 milliseconds this way: select(undef, undef, undef, 0.25); [...] -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734 ** I need a publisher for my book Learning Perl's Regular Expressions **
Re: Sleeping for less than a second
On Wed, May 30, 2001 at 01:42:17PM -0400, Craig Moynes/Markham/IBM wrote: Hi all, my DNS server is down so I can't check online. No need to check online. This answer is in the FAQ that comes with Perl. Is there anyway to sleep for less than a second using the default installation of perl ? And if not what CPAN module should I use when I get my internet connection back up ? $ perldoc -q sleep Found in /usr/local/lib/perl5/5.6.1/pod/perlfaq8.pod How can I sleep() or alarm() for under a second? If you want finer granularity than the 1 second that the sleep() function provides, the easiest way is to use the select() function as documented in the select entry in the perlfunc manpage. Try the Time::HiRes and the BSD::Itimer modules (available from CPAN). Walt -- Walter C. Mankowski Senior Software EngineerMyxa Corporation phone: (610) 234-2626 fax: (610) 234-2640 email: [EMAIL PROTECTED]http://www.myxa.com
Re: Sleeping for less than a second
--- Craig Moynes/Markham/IBM [EMAIL PROTECTED] wrote: Is there anyway to sleep for less than a second using the default installation of perl ? Yes, though it isn't pretty. =o) select(undef, undef, undef, 0.25); # the last arg is seconds c.f. perldoc -f select __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
Re: Sleeping for less than a second
On Wed, May 30, 2001 at 01:47:55PM -0400, Jeff Pinyan wrote: =head1 Found in /usr/local/lib/perl5/5.00502/pod/perlfaq8.pod Looks like you're overdue for an upgrade... :-) Walt -- Walter C. Mankowski Senior Software EngineerMyxa Corporation phone: (610) 234-2626 fax: (610) 234-2640 email: [EMAIL PROTECTED]http://www.myxa.com