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

Re: [MacPerl] how to check for machine architecture?



On Sun, 4 Jul 1999 01:13:04 +0200, Axel M. Roest wrote:
>
>I want my script to run semi-transparently under unix perl or MacPerl.
What
>is the preferred way to check on what kind of machine the script is
running?
>On unix I have $ENV variables to check, but what do I have on the Mac?
>
>I thought about grepping the output of `pwd` for either : or /, but surely
>there must be a better way?

Check the value of $^O. On MacPerl, this contains "MacOS". It takes
different values on the various flavors of Unix, so usually one does
something like

if ($^O eq "MacOS") {
     # Mac stuff
} else {
     # Unix stuff
}

>
>TIA
>
>
>Axel Roest
>_____________________________
>Axel M. Roest                | AXEL Development & Support
>info@axel.nu                 | Macintosh developer & UNIX sysadmin
>http://www.axel.nu           | 42
>
>
>



-------
Paul J. Schinder
schinder@pobox.com


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org