Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Can I write a transparent shell wrapper to start the correct build of Perl?

by Tanktalus (Canon)
on Oct 11, 2013 at 16:50 UTC ( #1057922=note: print w/ replies, xml ) Need Help??


in reply to Can I write a transparent shell wrapper to start the correct build of Perl?

I know this is an old thread, and I know I've already responded to it, but, since then, I've come up with and am using a completely different method for dealing with situations similar to this.

I have a "dev_perl" script. Written in perl. And I put that into the #! line. (Well, I actually have it in the PATH and use #!/bin/env dev_perl, but close enough.)

So, this dev_perl script is something like this:

#!/usr/bin/perl my $os = $^O; # You may need something more complex - I do my $version = '5.10'; # I need more complex than this exec "/nfs/perl/$version/$os/bin/perl", @ARGV;
In my case, I actually determine which workspace I'm in, version of our product, map that to the desired perl level, and look up where that level is from another file. And then I basically exec that version with all the original parameters. I also allow that if the command line has something that looks like /^5\.\d+\.\d+$/ as the first parameter, I shift that off and use it as the version instead of trying to detect the version. I could, instead, look for the command to run (which might not be the first parameter - I often use "dev_perl -d $tool @params" to debug stuff), and try to see if there is a "use 5.10.1" or some such in there to determine what level to run, I suppose, but I haven't found the need yet.

Note how this script uses /usr/bin/perl - which should exist on all unix-like platforms. And the main reason for all this extra overhead? Because doing the complex stuff is far easier in perl than shell.


Comment on Re: Can I write a transparent shell wrapper to start the correct build of Perl?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2014-11-29 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (204 votes), past polls