Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: cross platform scripts

by rob_au (Abbot)
on Jan 21, 2003 at 21:16 UTC ( #228849=note: print w/ replies, xml ) Need Help??


in reply to cross platform scripts

I actually posted a node with a solution to a similar problem in an older thread just a few days ago - The thread in question can be found here.

In this thread I posted a reference to the if module which allows the selective loading of modules based upon conditional tests. In the thread which I have referenced, I posted a snippet of the code would load separate configuration modules based upon the operating system of execution:

use if ( $^O eq 'MSWin32' ), 'MyAppWin32'; use if ( $^O ne 'MSWin32' ), 'MyAppUnix';

Perhaps this is of use to you :-)

 

perl -le 'print+unpack("N",pack("B32","00000000000000000000001000100001"))'


Comment on Re: cross platform scripts
Download Code
Replies are listed 'Best First'.
Re: Re: cross platform scripts
by timbu (Novice) on Jan 21, 2003 at 21:27 UTC

    This is exactly what I was looking for.

    thanks

    <This signature intentionally blank>

Re: Re: cross platform scripts
by John M. Dlugosz (Monsignor) on Jan 21, 2003 at 22:55 UTC
    I wonder if the argument to use can simply be conditional, without needing a helper module?

    use ($^O eq 'MSWIn32' ? 'MyAppWin32' : 'MyAppUnix');
    I think that should work in principle, since the comparison will be done before the use. It's just a matter of checking the docs to see what the differences are between barewords and normal strings in the use/require magic.

    —John

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-07-30 05:29 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 (270 votes), past polls