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

Re: [MacPerl] Idle Time



At 8:09 Uhr -0500 30.10.1998, Chris Nandor wrote:
>The constants represent four-character codes.  So installing IdleTime,
>restarting, and running this:
>
>  #!perl -wl
>  use Mac::Gestalt qw(%Gestalt);
>  print $Gestalt{'idle'};
>
>Gives me some numbers that appear to be what you are looking for.
>
>If IdleTime is ever a standard thing, one could lobby Matthias to put a
>constant in Gestalt.pm for it, but this code works just fine for me, it
>seems.

I feel I have to disagree: For some reason if I try

#!perl -w
use Mac::Gestalt qw(%Gestalt);
foreach (1..100){
  print $Gestalt{'idle'};
}

I get the same number 100 times. So I guess Matthias' code reads the
gestalt selectors once into the %Gestalt hash, but it does not anticipate
the fact that for Gestalt "idle" it has to be updated regularly, i.e. for
every call. This may become a problem in other cases, too. As far as I
know, Gestalt selectors don't have to be static over time. I guess you may
have overlooked this, Chris? Or am I completely wrong? Is it possible to
force an update somehow?


__Peter Hartmann________

Ritsumeikan University, Kyoto, Japan

e-mail:
hartmann@mbox.kyoto-inet.or.jp (preferred)
phv00542@askic.kic.ritsumei.ac.jp




***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch