Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Writing portable code

by tobyink (Abbot)
on Mar 08, 2013 at 09:51 UTC ( #1022369=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    BEGIN {
      $^O eq 'Win32'
        ? eval q[ sub f { ... } ]  # Win32 implementation
        : eval q[ sub f { ... } ]  # Linux implementation
    };
    
  2. or download this
    BEGIN { eval($^O eq 'Win32' ? <<'WIN32' : <<'LINUX') };
    sub f { print "f-w\n" }
    ...
    sub f { print "f-l\n" }
    sub g { print "g-l\n" }
    LINUX
    
  3. or download this
    use constant BROKEN_FORK_IMPLEMENTATION => ($^O eq 'Win32');
    
    ...
          ...;
       }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022369]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2017-01-23 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (194 votes). Check out past polls.