gmpassos has asked for the wisdom of the Perl Monks concerning the following question:

I need to identify in what OS my module Statistics::R is running to can load the right communication bridge for each OS.

Now I'm adding Mac OS X support, and I need to know what is the value of $^O to can do that.

An user sent to me that the value is 'darwin', but this is not a value specific for Mac OS X, since 'darwin' is used for more than one OS, as we can see at perlport. So, I need to know if there is other values on Mac OS X (maybe 'linux'can be one), and if there is a better way to identify that for Mac OS X.

Thanks in advance.

Graciliano M. P.
"Creativity is the expression of the liberty".

  • Comment on What is the right value of $^O to identify Mac OS X?

Replies are listed 'Best First'.
Re: What is the right value of $^O to identify Mac OS X?
by adrianh (Chancellor) on Apr 29, 2004 at 14:31 UTC

    The value of $^O on Mac OS X is "darwin" because, at the Unix level, it is just another darwin based OS. All the Mac OS X specific stuff is built on top of the darwin core.

    What Mac OS X specific 'communication bridge' are you using? You will probably need to test for that separate from the OS.

      The module has a bridge class for each OS. I really need to build one for Mac OS X since the installation of R-project on it is different.

      Graciliano M. P.
      "Creativity is the expression of the liberty".

        I'm still unsure what you mean by "bridge class".

        The Mac OS X install of R installs the same sort of things as any other Unix variant of R (ignoring the Aqua GUI). You should be able to treat it like any other Unix.

        The binary distribution puts it all in a Mac OS framework, but that should only be a case adding /Library/Frameworks/R.framework/Resources/bin and friends to the normal paths you would search for R in.

        One would hope that the search paths would be user configurable anyway for those who do not / cannot install R in the default location.

        What am I missing? What exactly do you need to do differently on Mac OS X?

Re: What is the right value of $^O to identify Mac OS X?
by Anomynous Monk (Scribe) on Apr 29, 2004 at 17:19 UTC
    Not sure what you mean. perlport should be the definitive source for $^O values, and it says "darwin". What exactly is your question (since it doesn't actually seem to be asking for the $^O value)?
      As you can see in the table in perlport, 'darwin' is not an exclusive value for Mac OS X, so, I need to identify if I'm realy on Mac OS X.

      Graciliano M. P.
      "Creativity is the expression of the liberty".

        I see an entry for "darwin" also. Does darwin in fact build anywhere other than Mac OS X? And if so, does perl compile there?