Michael G Schwern via RT wrote: >>[schwern - Tue Jul 15 18:31:18 2003]: >>The attached patch fixes this bug by the simple method of storing the >>Perl we started >>with as an absolute path before anything is done. Then perl() can >>reference this >>information. I can't see how this could go wrong on MacOS. >> >>I've also taken the liberty of speeding up perl() by caching its >>result. >> >> > >This patch was never applied. > >I've attached a better patch which simply moves the find perl logic from >individual CPAN::Distribution objects to be a function of the CPAN. The >location of Perl is simply cached in a global. > The (new) patch looks fine to me (not that I'm any CPAN.pm expert), but before I apply it I'm just curious to understand why the existing code doesn't work.
On my Win32 system, if I set the PATH to be just "C:\WINDOWS;C:\WINDOWS\system32" and cd to C:\perl then the command bin\perl -MCPAN -e shell followed by, say, "make Sort::Versions" works fine. (My perl binary is installed as C:\perl\bin\perl.exe) CPAN::Distribution::make does indeed chdir to the build directory before calling CPAN::Distribution::perl, but that succeeds in finding perl (C:\perl\bin\perl.exe) even though there is no bin\perl in the build directory. It continues to work even after I insert $^X = 'bin\\perl' at the start of CPAN::Distribution::perl to simulate an OS that doesn't set $^X to an absolute path. It works because the DIST_PERLNAME: foreach $perl_name ($^X, 'perl', 'perl5', "perl$]") { PATH_COMPONENT: foreach $component (File::Spec->path(), $Config::Config{'binexp'}) { loops succeed when $perl_name is 'perl' and $component is $Config::Config{'binexp'} (in my case, 'C:\perl\bin'). Why doesn't this work out for you? ------------------------------------------------ Radan Computational Ltd. The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.