Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Perl on OSX > Re: Detecting O...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 14 of 16 Topic 999 of 1075
Post > Topic >>

Re: Detecting OS X version from perl

by peter@[EMAIL PROTECTED] (Peter N Lewis) Nov 18, 2007 at 05:02 PM

At 17:52 -0700 15/10/07, Chris Nandor wrote:
>In article <20071014162925.GA7085@[EMAIL PROTECTED]
>,
>  david@[EMAIL PROTECTED]
 (David Cantrell) wrote:
>  > ie whether it's 10.0, 10.1 etc, I don't care about the difference
>>  between 10.3.3 and 10.3.4.
>
>This is nice in that it doesn't depend on external processes (sw_vers,
>Finder) or files.
>
>    use Mac::Gestalt qw(%Gestalt gestaltSystemVersion);
>    (my $version = sprintf("%x", $Gestalt{gestaltSystemVersion()})) =~
>       s/^(\d+)(\d)(\d)$/$1.$2.$3/;

Note that gestaltSystemVersion tops out at ".9", so it will return 
10.4.9 for all future 10.4 updates (including 10.4.10 and 10.4.11 
etc).

Fortunately, this does not affect you.

You can use gestaltSystemVersionMajor, gestaltSystemVersionMinor, and 
gestaltSystemVersionBugFix to return the three parts of the version 
(10, 4 and 11).

Enjoy,
    Peter.

-- 
Keyboard Maestro <http://www.keyboardmaestro.com/>
Macros for your Mac
<http://www.stairways.com/>
          <http://download.stairways.com/>
 




 16 Posts in Topic:
Detecting OS X version from perl
david@[EMAIL PROTECTED]   2007-10-14 17:29:25 
Re: Detecting OS X version from perl
emoy@[EMAIL PROTECTED] (  2007-10-14 10:45:30 
Re: Detecting OS X version from perl
david@[EMAIL PROTECTED]   2007-10-14 23:56:52 
Re: Detecting OS X version from perl
cdevers@[EMAIL PROTECTED]  2007-10-14 21:37:11 
Re: Detecting OS X version from perl
JD@[EMAIL PROTECTED] (Jo  2007-10-14 19:25:12 
Re: Detecting OS X version from perl
pudge@[EMAIL PROTECTED]   2007-10-15 17:52:04 
Re: Detecting OS X version from perl
nospam@[EMAIL PROTECTED]   2007-11-17 13:21:45 
Re: Detecting OS X version from perl
mbarto@[EMAIL PROTECTED]   2007-11-17 16:37:06 
Re: Detecting OS X version from perl
lprall@[EMAIL PROTECTED]   2007-11-17 21:36:41 
Re: Detecting OS X version from perl
cdevers@[EMAIL PROTECTED]  2007-11-17 21:46:17 
Re: Detecting OS X version from perl
kurtzlepirate@[EMAIL PROT  2007-11-18 10:49:22 
Re: Detecting OS X version from perl
mbarto@[EMAIL PROTECTED]   2007-11-18 17:40:51 
Re: Detecting OS X version from perl
brian.d.foy@[EMAIL PROTEC  2007-11-19 20:22:32 
Re: Detecting OS X version from perl
peter@[EMAIL PROTECTED]   2007-11-18 17:02:02 
Re: Detecting OS X version from perl
brian.d.foy@[EMAIL PROTEC  2007-11-18 21:22:04 
Re: Detecting OS X version from perl
cdevers@[EMAIL PROTECTED]  2007-11-20 22:21:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 3:32:41 CDT 2008.