Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: code that runs (and works) on both Linux and Win32

by cdarke (Prior)
on Sep 02, 2011 at 10:46 UTC ( #923821=note: print w/ replies, xml ) Need Help??


in reply to code that runs (and works) on both Linux and Win32

Perosnally I use the if pragma for loading modules. I put platform specific code into subroutines, and call via a dispatch table:

# simplified my %g_dt = (MsWin32 => \&WinStuff, linux => \&LinuxStuff, # and so on ); ... # The call $g_dt{$^O}->(args);
(With suitable checks at load time to ensure $^O is a key to %g_dt)


Comment on Re: code that runs (and works) on both Linux and Win32
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2015-07-05 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls