A simple symbolic link would fix the problem:
On the SGI machines
# ln -s /usr/local/bin/perl /usr/bin/perl
Surely that can't be too much to ask of the sysadmins...
-Blake
| [reply] [d/l] |
You'd think so, but I have been requesting that link for two weeks now and am not holding my breath. :/
| [reply] |
So, based on the other posts, you can't get your BOFH to install a symbolic link, and the SGI machines have both Perl 4 and Perl 5, and the default path invokes Perl 4.
A couple of other things to try:
- If you can change the default path on the SGIs, put the Perl 5 directory first, then use the eval 'exec perl ...' if 0 trick.
- Use the "pack up the dirt in another script" idea, but in reverse. In other words, write a shell script perlwrap, which on the Linux machines contains
#! /bin/bash
exec /usr/bin/perl $*
and on the SGI machines contains:#! /bin/sh
exec /usr/local/bin/perl $*
Then you can preface your scripts with
#! /usr/local/bin/perlwrap(or whever you put it). At least this way you can deploy the same Perl script, and your users can just type the script name.
Yeah, it's ugly, and needs more maintenance than the symlink, but it should work.
Personally, I'd keep trying the path and/or symlink thing before I resort to that second option.
Update
Nevermind, read perrin's note above. I kept thinking there was a better way....
| [reply] [d/l] [select] |
Thanks for all the suggestions, Perrin's suggestion is working and will make my life easier until I eventually get my symlink.
| [reply] |
Here's a unique workaround that I've come across in the past-- replace #!/usr/local/bin/perl or #!/usr/bin/perl (or whatever) with the following:
eval 'exec perl -S $0 "$@"'
if 0;
# Rest of code goes here
Hope it helps.
scott. | [reply] [d/l] [select] |
Should have mentioned this in the original post, but the SGI machines have two versions of perl. Unfortunately, "perl" on the SGIs invokes the old 4.x version; otherwise this solution would work great.
Thanks
| [reply] |
#!/usr/bin/env perl
If you make sure the right perl is first in your path, it will run that. This is all in the perlrun manpage. | [reply] [d/l] |
if there are few machines, a symbolic link should IMO do it (give it a try, i don't know it since i can't test it)
ln -s /usr/local/bin/perl /usr/bin/perl
on the sgi's and then change everything to /usr/bin/perl.
HTH | [reply] |