[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Unix daemons in MacPerl (step two)



sleep(); doesn't seem to work correctly in conjunction with Toolbox Calls 
(the problem is that the OS processes Toolbox calls WHILE the perl 
process is sleeping).  Since we've already invoked Mac::Events (for 
things that go into step three and beyond), I just wrote a little 
subroutine ( wait() being unimplemented in MacPerl, but also still being 
a reserved word, I'm looking for a better name ), which does the job.  
Also note the use of SetMenuFlash() (I told you I'd find another way).

#!perl -w

use strict;
use Mac::Menus;
use Mac::Events;

Wait(300);

SetMenuFlash(2);
FlashMenuBar(0);
FlashMenuBar(0);

sub Wait {
# return true until $numTicks reached
    my $numTicks = shift;
    my $start = TickCount();
    1 while (TickCount() - $start < $numTicks);
}

__END__

The easy stuff is done.  Next comes the hard part: Making the process 
"polite" so that it gives it's clock cycles back to the OS.

Brian McNett, Webmaster
*************************************************************
Mycoinfo. The world's first mycology e-journal.
http://www.mycoinfo.com/
*************************************************************


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org