Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Problem with MacPerl

by CiceroLove (Monk)
on Feb 15, 2001 at 00:20 UTC ( #58438=note: print w/replies, xml ) Need Help??


in reply to Problem with MacPerl

I'm come from a long line of Mac lovers. (I'm looking at my PowerBook G3 running my mail server right now). MacPerl is in my opinion a dastardly half-migration of Perl per se. Things like sleep and @readinlines = <DATAFILE>; do not work as expected if you are coming from a *NIX environment. I am sad to say that sleep is just as dastardly in AppleScript. (as a side note, sleep is also a crappy command in AppleScript but is supposed to be changed in OSX). The reason why sleep does not work is that it cannot break the "command cycle". That si to say it must wait until an empty moment to be run. But it's sleeping so the OS just skips right over its request, the script wakes up because the OS "touched" it and then waits until the OS comes around again. But by that time it's already asleep again! This is obviously not the intended behaviour. An Apple Engineer explained to me at MacWorld that the best thing to do is give it a task that must be waited upon by the OS, so that the suggestion above to do selects and stuff is probably your best short term bet. In that way, you can be doing something in the background that would require the OS to leave and come back to give processor time you would have a better chance of getting your script to run. Or using an extension (I can't remember the name of some right now but you can find them on versiontracker.com) because extensions live in the processor cycle. I know htis is long but one last thing. There is a Scripting Addition that does true mutli-tasking that you could use with Appelscript to create a similar "sleep" behaviour. You can email me at gregs@l90.com is you want more info. HTH CiceroLove

Replies are listed 'Best First'.
(Coyote) Re: Re: Problem with MacPerl
by Coyote (Deacon) on Feb 15, 2001 at 00:46 UTC
    Just to add to the previous node, you can use Scripting Additions directly from MacPerl using the Mac::Glue module if you want to go that route.

    ----
    Coyote

Re: Re: Problem with MacPerl
by pudge (Sexton) on Apr 15, 2002 at 15:52 UTC
    @array = <FILE> works exactly the same as on Unix. It is just entirely false to say otherwise.

    And sleep() works as intended. OK, so it can't just begin sleeping right away if something else is happening; welcome to cooperative multitasking! To blame MacPerl for the Mac OS architecture is pretty silly.

    One may also wish to look into Mac::Events::WaitNextEvent() for some purposes.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://58438]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2021-06-22 23:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (110 votes). Check out past polls.

    Notices?