On Wed, Mar 13, 2002 at 11:55:48AM +0000, Edward Avis wrote:
> Okay. The patch you suggested, quoting spaces with backslashes, does
> not work because Win2k's command shell doesn't grok backslashes. Here's
> my patch:
>
> - --- MM_Win32.pm Tue Sep 4 14:24:00 2001
> +++ MM_Win32.pm.new Wed Mar 13 11:45:30 2002
> @@ -160,8 +160,26 @@
> print "Checking $abs\n" if ($trace >= 2);
> next unless $self->maybe_command($abs);
> print "Executing $abs\n" if ($trace >= 2);
> - - $val = `$abs -e "require $ver;" 2>&1`;
> - - if ($? == 0) {
> +
> + my $tmp_out = 'out.tmp';
> + if ($trace < 2) {
> + # Hide stdout and stderr.
> + open(OLDOUT, '>&STDOUT') or die "cannot dup stdout: $!";
> + open(OLDERR, '>&STDERR') or die "cannot dup stderr: $!";
> + open(STDOUT, ">$tmp_out")
> + or die "cannot write to $tmp_out: $!";
> + open(STDERR, ">$tmp_out")
> + or die "cannot write to $tmp_out: $!";
> + }
> + my $ok = not system($abs, '-e', "require $ver;");
> + if ($trace < 2) {
> + open(STDERR, '>&OLDERR')
> + or die "cannot dup stderr back again: $!";
> + open(STDOUT, '>&OLDOUT')
> + or die "cannot dup stdout back again: $!";
> + }
> +
> + if ($ok) {
> print "Using PERL=$abs\n" if $trace;
> return $abs;
> } elsif ($trace >= 2) {
>
>
> But I think this code would better be shared among several MM_x files
> rather than just for Win32. Perhaps MM_Unix could hold it and MM_Win32
> could inherit it somehow? I don't know how all this stuff works.
Neither do I sometimes. :)
> The present MM_Unix implementation is slightly different to Win32's
> but I think this code should work for both.
I'll have a crack at unifying them somewhat. More likely is I'll have
a crack at collecting together all the `` and system() calls into one
safe function that basically does the above.
Instead of a tmp file I'll probably switch that to File::Spec->devnull
or try something with tying. I think it was tying that got me in
trouble last time.
Thanks for that patch, it'll be in 5.51_01.
> >>It might be a good idea to make the code taint-clean,
>
> >Yes. After that we'll be unifying Gravity and Electromagnetism and
> >then World Peace will be brought about just after supper. :)
>
> I just suggest it as a debugging aid, not as a new feature to implement.
> You can turn on -T, fix a couple of things that break and thus hopefully
> a couple of quoting bugs, and then turn -T off again to continue with
> normal development. After world peace is achieved, of course, the code
> can be distributed with -T set.
Even better, I can use the new -t or the ok -UTw. Or you can! :)
Sorry to keep punting this back, but its very low on the priority
list. Do you have any thoughts on the PREFIX/LIBification behavior
maybe?
http:[EMAIL PROTECTED]/msg00157.html
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
pleasing symmetry
the paste goes in at one end
comes out the other.
-- mjd