My next target for cleanup is the find_perl() commands.  Looking at all the
various platform specific ones, it seems the only one that can't currently
be unified is MM_VMS->find_perl.  There's some basic differences in how the
search is sorted, but that's ok.  All the code which preformats the
directories to be search and the perl names to be search for can be dealt
with.

What I can't figure out are these bits:

Why the special processing for relative directories?

    foreach $dir (@sdirs){
        next unless defined $dir; # $self->{PERL_SRC} may be undefined
        $inabs++ if File::Spec->file_name_is_absolute($dir);
        if ($inabs == 1) {
            # We've covered relative dirs; everything else is an absolute
            # dir (probably an installed location).  First, we'll try potential
            # command names, to see whether we can avoid a long MCR expression.
            foreach $name (@snames) { push(@cand,$name) if $name =~ /^[\w\-\$]+$/; }
            $inabs++; # Should happen above in next $dir, but just in case . . .
        }
        foreach $name (@snames){
            if ($name !~ m![/:>\]]!) { push(@cand,$self->catfile($dir,$name)); }
            else                     { push(@cand,$self->fixpath($name,0));    }
        }
    }


Why do we have special code here to try and figure out if its a command...

        # If it looks like a potential command, try it without the MCR
        if ($name =~ /^[\w\-\$]+$/) {
            open(TCF,">temp_mmvms.com") || die('unable to open temp file');
            print TCF "\$ set message/nofacil/nosever/noident/notext\n";
            print TCF "\$ $name -e \"require $ver; print \"\"VER_OK\\n\"\"\"\n";
            close TCF;
            $rslt = `\@temp_mmvms.com` ;
            unlink('temp_mmvms.com');
            if ($rslt =~ /VER_OK/) {
                print "Using PERL=$name\n" if $trace;
                return $name;
            }
        }

and then immediately afterwards we call maybe_command() to figure out if its
a command... but didn't we just do that?

        next unless $vmsfile = $self->maybe_command($name);

and then we try the command again, but in a slightly different way.

        $vmsfile =~ s/;[\d\-]*$//;  # Clip off version number; we can use a newer 
version as well
        print "Executing $vmsfile\n" if ($trace >= 2);
        open(TCF,">temp_mmvms.com") || die('unable to open temp file');
        print TCF "\$ set message/nofacil/nosever/noident/notext\n";
        print TCF "\$ mcr $vmsfile -e \"require $ver; print \"\"VER_OK\\n\"\"\" \n";
        close TCF;
        $rslt = `\@temp_mmvms.com`;
        unlink('temp_mmvms.com');
        if ($rslt =~ /VER_OK/) {
            print "Using PERL=MCR $vmsfile\n" if $trace;
            return "MCR $vmsfile";
        }

Is this all just leftovers from before `` and system() worked properly?

I've noticed that the basic "try it without MCR, else try maybe_command()
and try it with MCR" logic has been there for a while, but 5.6.1 introduced
the extra temp_mmvms.com logic.  What's it all doing?


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
But let us not dwell on such unhappy things.  Let us instead think of 
pancakes--moist, delicious pancakes, dripping with syrup and hot butter.
        -- http://www.angryflower.com/timelo.gif

Reply via email to