weigand has asked for the wisdom of the Perl Monks concerning the following question:
I have several different machine architectures and OS (linux 2.4, linux 2.6, solaris, etc.). For each of those, I have several different builds of perl (with threads, without threads, with specific versions of modules, etc.).
I want to have a shell script which will act as a wrapper to choose the right perl version. I know how to figure out the OS and architecture automatically using uname and such. And I will pass special command line arguments to it in order to tell it that I want the threaded perl version or the non-threaded one. Etc.
But I'm getting into trouble.
Let's say the wrapper shell script is at "/usr/local/bin/perl_wrapper". I would really like to do something like this in my perl script:
#! /usr/local/bin/perl_wrapper print "Hello World!\n";
But that doesn't seem to work, because apparently "#!" needs to be followed by a compiled binary, not a shell script?
Okay, I can accept that. So I tried using "env" instead:
#! /usr/bin/env /usr/local/bin/perl_wrapper print "Hello World!\n";
Hey, that works! Great. Now let me just add that "-w" perl switch to it....
#! /usr/bin/env /usr/local/bin/perl_wrapper -w print "Hello World!\n";
Uh-oh! I get this error message:
/usr/bin/env: /usr/local/bin/perl_wrapper -w: No such file or direct +ory
It's like it's trying to find a file called "/usr/local/bin/perl_wrapper -w".
Okay, what do I do now? You can't pass command line arguments when you use /usr/bin/env?
Any help would be appreciated.
Thanks!
--- UPDATE: For some reason, my carriage return characters aren't showing up in the text above? Oy.
--- UPDATE 2: Okay, now it should be formatted better.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl wrapper
by ikegami (Patriarch) on Mar 15, 2011 at 23:12 UTC | |
|
Re: Perl wrapper
by ikegami (Patriarch) on Mar 15, 2011 at 23:27 UTC | |
by weigand (Initiate) on Mar 16, 2011 at 17:29 UTC | |
by ikegami (Patriarch) on Mar 16, 2011 at 18:12 UTC | |
by weigand (Initiate) on Mar 16, 2011 at 19:22 UTC | |
by ikegami (Patriarch) on Mar 16, 2011 at 20:01 UTC | |
|
Re: Perl wrapper
by cdarke (Prior) on Mar 16, 2011 at 09:30 UTC | |
by Anonymous Monk on Mar 16, 2011 at 13:04 UTC | |
|