in reply to including modules during runtime and dealing with OS specific (constants) code block

The Win32 issues discussed above not withstanding, a better way of conditonally including modules is to use the if pragma. Here is a working fragment, you should be able to modify it for the APIs you need, and for Mac:
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: including modules during runtime and dealing with OS specific (constants) code block
  • Download Code