@@ -415,6 +415,7 @@ sub constants {
415415 PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST
416416 PERL_CORE
417417 PERM_DIR PERM_RW PERM_RWX
418+ SHEBANG
418419
419420 ) )
420421 {
@@ -1174,8 +1175,9 @@ WARNING
11741175
11751176Inserts the sharpbang or equivalent magic number to a set of @files.
11761177
1177- If the environment variable C<PERL_MM_FORCE_SHEBANG=relocatable > is set,
1178- then any found shebang/sharpbang lines are set to C<#!/usr/bin/env perl > .
1178+ If the WriteMakefile option C<SHEBANG > is set to "relocatable", then any found
1179+ shebang/sharpbang lines are set to C<#!/usr/bin/env perl > instead of the
1180+ default perl.
11791181
11801182=cut
11811183
@@ -1251,8 +1253,17 @@ sub _fixin_replace_shebang {
12511253
12521254 # Now look (in reverse) for interpreter in absolute PATH (unless perl).
12531255 my $interpreter ;
1254- if ( defined $ENV {PERL_MM_FORCE_SHEBANG } && $ENV {PERL_MM_FORCE_SHEBANG } eq " relocatable" ) {
1255- $interpreter = " /usr/bin/env perl" ;
1256+ if ( defined $ENV {PERL_MM_SHEBANG } ) {
1257+ if ( $ENV {PERL_MM_SHEBANG } eq " relocatable" ) {
1258+ $interpreter = " /usr/bin/env perl" ;
1259+ print " SHEBANG option set to 'relocatable': Changing shebang from '$cmd $arg ' to '$interpreter '"
1260+ if $Verbose ;
1261+ $arg = " " ; # args don't work with /usr/bin/env perl
1262+ }
1263+ else {
1264+ print " SHEBANG option set to something other than 'relocatable': Ignoring it"
1265+ if $Verbose ;
1266+ }
12561267 }
12571268 elsif ( $cmd =~ m { ^perl(?:\z |[^a-z])} ) {
12581269 if ( $Config {startperl } =~ m , ^\# !.*/perl, ) {
@@ -1863,6 +1874,8 @@ EOP
18631874
18641875 $self -> {LIBPERL_A } ||= " libperl$self ->{LIB_EXT}" ;
18651876
1877+ $self -> {SHEBANG } ||= ' ' ;
1878+
18661879 # make a simple check if we find strict
18671880 warn " Warning: PERL_LIB ($self ->{PERL_LIB}) seems not to be a perl library directory
18681881 (strict.pm not found)"
0 commit comments