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

Re: [MacPerl] Platform checking



At 08:34 96-03-13, Russ Tremain wrote:

>Does anyone have a general method that will work on dos,
>nt, vms, unix, and the mac, that is independent of perl revision?

This was discussed a while back (December or so).  The concensus was,
use the Config module if possible.

If you need your solution to work under Perl 4 as well, the following
incantation covers a lot of ground:
eval '$os = `uname`';
$os = 'Unix' if $os;  # if you just need generic OS
$os = 'Mac' if defined( $MacPerl'Version );
$os = 'NT' if ($] =~ /NT/) && ! $os;
$os = 'Dos' unless $os;

VMS can probably be added easily.  (I don't know if vms supports uname or not.)

I don't know if Sandra updated the primer after that discussion, but
you should check it out for information like this.  It's at:
<URL:http://www.unimelb.edu.au/~ssilcot/macperl-primer/home.html>


--Hal
Hal Wine <hal@dtor.com>     voice: 510/482-0597