Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: including modules during runtime and dealing with OS specific (constants) code block

by cdarke (Prior)
on Aug 02, 2011 at 07:34 UTC ( [id://917990]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://917990]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found