Charles Bailey [EMAIL PROTECTED] writes:
> Charles Lane <[EMAIL PROTECTED]> wrote:
> : > Charles Lane <[EMAIL PROTECTED]> wrote:
> : > | Charles Bailey [EMAIL PROTECTED] wrote:
> : > | > Charles Lane <[EMAIL PROTECTED]> wrote:
> : > | I'd like to note that if we start using Perl features (@INC, $^X) for
> : > | things other than what they were intended, we are asking for trouble.
> : > | Just my opinion.
> :
> : > . . . and a reasonable one, too. I'm not sure we're straying from the
> : > intended purpose of @INC, though -- this is a type of library file, in
> : > some ways like the (new) dependence of CORE::glob() on File::Glob() (under
> : > certain non-VMS OSs) or -d on perldb.pl.
> :
> : This is just *asking* for a mysterious problem in future. At least
> : logicals are automatically available to subprocesses, so they'll have
> : the same basic environment as their parent process.
> Sounds like a philosophical difference here -- no problem. Perhaps we
> could try an intermediate approach:
>
> 1. Try ARCHLIB/SITEARCH/VENDORARCH directly.
> 2. Try dirname($ENV{PERLSHR}) || 'SYS$SHARE:'
> 3. Fail.
>
> That'll avoid the "user fouls up @INC" concern.
Well, I just spent much of this morning coding up the "looking for a
VMSPIPE in all the wrong places" routine. And (while I was at it)
making sure that we really can build and test *without* Perl_root.
The current scheme:
Take @INC with default entries, -I values, but before script parsing,
so the user script can't mangle @INC.
Change around the order to put "." and -I stuff at the end:
[easier explained in Perl than C]:
foreach (@INC) {
next if $_ eq '.';
push @myinc, VMS::Filespec::unixpath($_);
}
push @myinc, '.';
Then take the directory from $^X (well, actually PL_origargs[0], since
$^X hasn't been set up when this particular bit of code is executed):
$here = $^X;
$here =~ s/\][^]]*$/]/; # trim off file, leave dir
push @myinc, VMS::Filespec::unixpath($here);
Then put the ARCHLIB in front, since that's where VMSPIPE should
be, 99% of the time:
unshift @myinc, $Config->{'installarchlib'} if $Config->{'installarchlib'};
So the search order is:
1. archlib -> perl_root:[lib.vms_(axp|vax).5_6_0]
2. the various archib/privlib/sitelib parts of @INC
3. the directories specified by -I
4. the current directory "."
In each directory we search for VMSPIPE.COM and check for read
and execute access.
If the search fails to find a usable VMSPIPE.COM, then we fall
back to writing a temp VMSPIPE:
1. Try to write to SYS$SCRATCH:
2. Try to write to SYS$LOGIN:
3. Try to write to current directory
If none of this works, then throw a WARN_PIPE message and
return from safe_popen with Nullfp.
To avoid the "someone stole my tempfile" problem, I use fgetname
and fstat on the file while open for write and get the full
name (including version), creation date and FID. We have
to close the file (since LIB$SPAWN doesn't "shr=put") and reopen
in read-mode, and then test creation date and FID to make sure
it's the same file.
This does work in the test suite with no PERL_ROOT (I explicitly
set it to a bogus value to make sure we had no dependance). A change
is required in [.vms]test.com to make the definition of PERLSHR to be
a process (not /user) logical, because otherwise [.t.lib]vmsish.t fails
as a result of the /user mode logical not getting shared with a comfile
running in a subprocess.
When you run the full test suite (100% success!), there are 93
tempfiles left at the end: these are places where a temp VMSPIPE was
used but not deleted because the command being run aborted. The total
number of files used is much greater.
This, by the way, implies that there's a *lot* of places in the
test suite where @INC doesn't lead us to VMSPIPE if we don't have
PERL_ROOT to help us out, probably because -I used in the test suite
is only getting us to [.lib] and not to [.lib.vms_axp.5_6_0] where
VMSPIPE actually lives.
Patch file on the way...
--
Drexel University \V --Chuck Lane
----------------->--------*------------<[EMAIL PROTECTED]
(215) 895-1545 / \ Particle Physics [EMAIL PROTECTED]
FAX: (215) 895-5934 /~~~~~~~~~~~ [EMAIL PROTECTED]