Blue_eyed_son has asked for the wisdom of the Perl Monks concerning the following question:

Any ideas how I can get to use usleep to work?
I try
use TIME::HiRes qw(usleep time alarm sleep); $nightpause=(2000); $time=localtime; if ($time=~/(\d+?):\d+?:\d+?/) { $hour=$1; } if ($hour<=6 or $hour>=17) { usleep ($nightpause); }
and I get a complaint that usleep is an undefined subroutine!

Replies are listed 'Best First'.
Re: usleep not.
by ikegami (Patriarch) on Jul 15, 2005 at 22:47 UTC

    You misspelled "Time::HiRes" as "TIME::HiRes".
    On Windows, that will load the module, but won't import anything.
    (On unix, use will die.)

      Time did it. Thanks!
Re: usleep not.
by BrowserUk (Patriarch) on Jul 15, 2005 at 22:48 UTC

    If your on Win32, use Win32::Sleep( $microseconds );. No need to install anything, it's a Win32 specific built-in.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.