In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (David Cantrell) wrote:

> Is there any simple way that people can think of to detect which major
> version of OS X my perl code is running on?
> 
> 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/;

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Technology Group       [EMAIL PROTECTED]     http://ostg.com/

Reply via email to