Subject: | Steal from MakeMaker |
MakeMaker has learned, over the years, how to identify various operating
systems across various versions of Perl. Most of this code lies in
ExtUtils::MM via building up a big %Is hash.
Some of the trickier ones are here:
Win9x, which works differently than XP and NT.
$^O eq 'MSWin32' and Win32::IsWin95();
U/WIN:
$^O =~ /^uwin(-nt)?$/;
Netware, which sometimes leaves $^O as MSWin32
$Config{osname} eq 'NetWare';
MakeMaker goes ahead and sets $^O to 'NetWare'.
BeOS whose $^O fluctuated:
$^O =~ /beos/i;
VOS which MakeMaker treats mostly like Unix but I don't think it really
is. I've never actually seen one.
$^O eq 'vos';
You've got VOS. I think perlport is wrong, looking at Configure, but I
think perhaps at one point it was right. You might want to do a case
insensitive check.
QNX, a real time Unix.
$^O eq 'qnx';
Operationally, MakeMaker treats both Cygwin and U/WIN as Unix with very
little alteration. I would say they should identify as both Unix and
Windows.
MakeMaker also found it handy to identify the BSD flavors, though it's
not used much anymore. *bsd, bsdos, interix and dragonfly:
$^O =~ /^(?:free|net|open)bsd$/
or grep( $^O eq $_, qw(bsdos interix dragonfly) )
Darwin is mostly a BSD, it ships with BSD tools, but is such an
amalgamation that I don't think anyone would blame you for leaving it
out of a "BSD" category.