NAME

ActiveState::OSType - Constants for platform specific conditional code

SYNOPSIS

  use ActiveState::OSType qw(IS_WIN32);
  
  if (IS_WIN32) {
     # do windows specific code
  }
  else {
     # do other code
  }

DESCRIPTION

This module exports the constants IS_WIN32, IS_DARWIN and IS_UNIX. These constants can be used to wrap conditional code for specific platforms. Using these constants instead of testing $^O directly allow perl to eliminate unused branches of the code at compile time. Thus

  if (IS_WIN32) {
      ...
  }

is exactly the same as

  if ($^O eq "MSWin32") {
      ...
  }

but the first form looks better and the whole block is eliminated at compile time if not running on a windows machine. The test:

  if (IS_UNIX) { ... }

is currently the same as

  if ($^O ne "MSWin32") { ... }

but this might change in the future if this module is made to support systems other than Windows and Unix. There is no simple $^O test that can determine if the OS is Unix.