Subject: | fix_shebang_line makes versioned shebang |
Date: | Sat, 27 Sep 2008 12:13:20 +0000 |
To: | bug-Module-Build [...] rt.cpan.org |
From: | Alexey Tourbin <at [...] altlinux.ru> |
lib/Module/Build/Base.pm:
2465 sub fix_shebang_line { # Adapted from fixin() in ExtUtils::MM_Unix 1.35
2466 my ($self, @files) = @_;
2467 my $c = ref($self) ? $self->{config} : 'Module::Build::Config';
2468
2469 my ($does_shbang) = $c->get('sharpbang') =~ /^\s*\#\!/;
2470 for my $file (@files) {
2471 my $FIXIN = IO::File->new($file) or die "Can't process '$file': $!";
2472 local $/ = "\n";
2473 chomp(my $line = <$FIXIN>);
2474 next unless $line =~ s/^\s*\#!\s*//; # Not a shbang file.
2475
2476 my ($cmd, $arg) = (split(' ', $line, 2), '');
2477 next unless $cmd =~ /perl/i;
2478 my $interpreter = $self->{properties}{perl};
2479
2480 $self->log_verbose("Changing sharpbang in $file to $interpreter");
2481 my $shb = '';
2482 $shb .= $c->get('sharpbang')."$interpreter $arg\n" if $does_shbang;
Here, $interpreter is e.g. /usr/bin/perl5.8.8, and, unlike
ExtUtils::MM_Unix::fixin(), this yields shebang line specific
to the installed perl version, which is rather undesired.
$ head -1 Module-Build-0.30/blib/script/config_data
#!/usr/bin/perl5.8.8
$
Perhaps $Config{startperl} should be used instead.
$ perl -le 'print $^X'
/usr/bin/perl5.8.8
$ perl -le 'use Config; print $Config{startperl}'
#!/usr/bin/perl
$