Re: Detecting OS X version from perl

[email protected] (brian d foy)
Newsgroups perl.macosx
Message-ID <191120072022325388%[email protected]>
In article <[email protected]>, Michael Barto
<[email protected]> wrote:

> Everyone has suggested  "system_profiler" for the hardware stuff. But it 
> appears that I will need do some parsing with
>  $ grep -A1 'BundleShortVersion' 
> /Library/Receipts/*.pkg/Contents/version.plist  | grep string

Why are you looking thare for hardware info?

You don't really need to do any parsing. It's a plist, so something
like Mac::PropertyList can handle that for you. The module is designed
to to the hard work for you so you can slap on a nice interface, but
that's not so bad.

I'm also thinking about creating something to provide the
system_profiler output as a Perl hash. You can get that with XML (which
is just another plist), though.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.