fixin them shebangs

ivorw on 2005-06-12T19:11:54

I have a machine with several different versions of perl on it. In particular, the default one I am wanting it to use for the present is /home/knoppix/ivor/stable/bin/perl

This was a relatively freshly built perl, and I found that none of the scripts worked, as they were looking for a perl in /usr/local/bin/perl - I deliberately did not put one there; the O/S supplied one was in /usr/bin/perl.

This prompted me to look into how scripts get installed. I found that ExtUtils::MM_Unix.pm has a method call fixin which becomes available through inheritance as ExtUtils::MY->fixin. Just pass in some paths of perl scripts as parameters, and they get shebangled - that's if they have a shebang line.

You can do this from the command line, in a similar fashion to how make does with exe_files:

perl -MExtUtils::MY -e 'MY->fixin(@ARGV)' *.pl

I've also tracked through to the Config, where it gets the information about what to put into the shebang line. This is in $Config{startperl}. If you want the scripts to be shebanged to somewhere exotic when you install them, hack Config.pm or edit config.sh (and remake your perl) to set startperl to be the correct place. You might also need to tweak perlpath in a similar way.