Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Writing portable code

by tobyink (Canon)
on Mar 08, 2013 at 09:51 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1022369]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-23 17:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found