Re: [Module-build-general] Patch to stop annoying warning on ./Build
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <ke...@ma...> - 2003-09-20 14:21:10
|
On Friday, September 19, 2003, at 01:40 PM, Ken Y. Clark wrote:
> All,
>
> I wrote a couple weeks ago about this annoying warning:
>
> * WARNING: Configuration was initially created with '/usr/bin/perl',
> but we are now using '/usr/local/bin/perl'.
>
> I finally took a couple minutes to look at the source, and I see that
> the "Build" script uses $Config{'startperl'} for the shebang, but most
> everything else looks for Module::Build::Base->find_perl_interpreter.
> The following patch fixes that.
Hi Ken,
Thanks for the patch. I'll actually apply it in a different form,
because the 'startperl' entry may often contain much weirder stuff on
non-unix platforms. Here's how I'll apply:
Index: lib/Module/Build/Base.pm
===================================================================
RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v
retrieving revision 1.195
diff -u -r1.195 Base.pm
--- lib/Module/Build/Base.pm 19 Sep 2003 16:48:26 -0000 1.195
+++ lib/Module/Build/Base.pm 20 Sep 2003 14:19:52 -0000
@@ -719,6 +719,8 @@
}
}
+sub _startperl { shift()->{config}{startperl} }
+
sub print_build_script {
my ($self, $fh) = @_;
@@ -733,9 +735,10 @@
}
my $quoted_INC = join ",\n", map " '$_'", @myINC;
+ my $shebang = $self->_startperl;
print $fh <<EOF;
-$self->{config}{startperl}
+$shebang
BEGIN {
\$^W = 1; # Use warnings
Index: lib/Module/Build/Platform/Unix.pm
===================================================================
RCS file:
/cvsroot/module-build/Module-Build/lib/Module/Build/Platform/Unix.pm,v
retrieving revision 1.2
diff -u -r1.2 Unix.pm
--- lib/Module/Build/Platform/Unix.pm 9 Jun 2002 05:45:08 -0000 1.2
+++ lib/Module/Build/Platform/Unix.pm 20 Sep 2003 14:19:52 -0000
@@ -18,6 +18,12 @@
$self->do_system("$gzip '$dir.tar'");
}
+sub _startperl {
+ my ($self) = @_;
+ my $perl = $self->find_perl_interpreter or warn "Can't find your
perl interpreter";
+ return "#! $perl";
+}
+
1;
__END__
|