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.

In reply to Re: Can I write a transparent shell wrapper to start the correct build of Perl? by Tanktalus
in thread Can I write a transparent shell wrapper to start the correct build of Perl? by thparkth

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":