On Thu, Feb 27, 2003 at 04:07:29PM +0800, Philippe M. Chiasson wrote: > On Thu, 2003-02-27 at 06:18, Ken Williams wrote: > > > > On Wednesday, February 26, 2003, at 09:59 AM, Nicholas Clark wrote to > > the Inline list: > > > > > As promised, er, a few months ago, here is a patch that makes Inline > > > work reliably when there is more than one perl installed, and all > > > *think* > > > that they are (say) /usr/local/bin/perl > > > > You mean that all of them have /usr/local/bin/perl as > > $Config{perlpath}, or that somehow symlinks or shebang paths are giving > > them that impression?
The former. Although I have quite a few perl binaries installed, and know how to hack Config.pm to (sort of) solve this, it's quite possible for any "normal" user to get this merely by installing (say) 5.8.0 over 5.6.1, while having some scripts that are explicity still run with /usr/local/bin/perl5.6.1 I'm not sure how perl copes with HP-UX, where (IIRC) argv[0] is set to the path of a script, not the interpreter. (Helpful systems put the interpreter in argv[0], seeing as the script's name is in argv[1] anyway) > > > With this Inline will "believe" $^X in preference to $Config{perlpath} > > > if $^X is an absolute path, so that Inline will get the same perl as is > > > running the script, despite the sysadmin's best efforts to confuse > > > things > > > by installing more perl versions. > > > > I'm interested in getting this right for Module::Build too. This seems > > like a reasonable approach to take. I think the big problem with $^X > > is that it can sometimes be set to just "perl" or something in shebang > > scripts, so checking for an absolute path seems like a good way to go. > > Thanks. > > Or even potentially worst, if running in a C programm that embeds a Perl > interpreter (read mod_perl), the value $^X will be that program (read > httpd), most certainly not always what one wants ;-( I'd not thought of that. I guess that one way is to also check if $^X =~ m!perl[^/]*! (or the directory separator equivalent to / as appropriate) as I'm not sure if running $^X -v to see if it's "perl" is safe. > Q: It is impossible to make anything foolproof because fools are so > ingenious. Hmm. Quite apt here :-) Or is that :-( Nicholas Clark