in reply to [Q]: How to include modules conditionally (using the pragma 'use')?

Here is an example of using the if pragma:
use strict; use if ($^O eq 'MSWin32'), 'Win32::Process'; use if ($^O ne 'MSWin32'), 'POSIX'; use if ($^O ne 'MSWin32'), 'POSIX' => ':sys_wait_h'; # Hack to allow compilation under UNIX # (NORMAL_PRIORITY_CLASS is Win32 only) use if ($^O ne 'MSWin32'), 'constant' => 'NORMAL_PRIORITY_CLASS';
  • Comment on Re: [Q]: How to include modules conditionally (using the pragma 'use')?
  • Download Code