Subject: | t/30shell.t warning if Makefile.PL not called with absolute interpretter path |
Date: | Wed, 31 Aug 2011 13:14:07 -0400 |
To: | bug-CPAN [...] rt.cpan.org |
From: | "Daniel Macks" <dmacks [...] netspace.org> |
Running self-tests of CPAN-1.9800 on OS X 10.6 against Apple's perl-5.10.0:
$ ARCHFLAGS="" /usr/bin/arch -i386 perl5.10.0 Makefile.PL PERL="/usr/bin/arch -i386 perl5.10.0" PREFIX=/sw INSTALLPRIVLIB=/sw/lib/perl5/5.10.0 INSTALLARCHLIB=/sw/lib/perl5/5.10.0/darwin-thread-multi-2level INSTALLSITELIB=/sw/lib/perl5/5.10.0 INSTALLSITEARCH=/sw/lib/perl5/5.10.0/darwin-thread-multi-2level INSTALLMAN1DIR=/sw/share/man/man1 INSTALLMAN3DIR=/sw/share/man/man3 INSTALLSITEMAN1DIR=/sw/share/man/man1 INSTALLSITEMAN3DIR=/sw/share/man/man3 INSTALLBIN=/sw/bin INSTALLSITEBIN=/sw/bin INSTALLSCRIPT=/sw/bin
[no unusual output]
$ make
[the usual build messages, nothing unsual]
$ make check
[...]
t/30shell.t .. Use of uninitialized value in concatenation (.) or string at t/30shell.t line 84.
The /usr/bin/arch game is just my specific case of calling Makefile.PL with a non-absolute path to the perl interp. It works fine (and it should) because "perl5.10.0" is in my PATH. That causes the warning because t/30shell.t does:
my @stat = stat $^X;
The interp name that is propagated via $^X is whatever was passed to Makefile.PL, in this case "perl5.10.0", but it's neither an absolute path a relative one from anywhere predictable, so it can't be stat()ed. What does work (for me) is:
my $interp = `which $^X`; # $^X might be found in PATH not rel/abs path
chomp $interp;
my @stat = stat $interp;
The portable solution would probably be to check if the original stat() fails, and if so fall back to my workaround, or else try this instead of original if $^X isn't absolute (avoids pitfall of a local filename that happens to match interp-name but isn't the interp?). Or else just use File::Which.
dan
--
Daniel Macks
dmacks@netspace.org