Operating System - OpenVMS
1753297 Members
6584 Online
108792 Solutions
New Discussion юеВ

Re: Adding to DCL$PATH in PERL

 
Craig A Berry
Honored Contributor

Re: Adding to DCL$PATH in PERL

As folks have figured out, you can't create search list logicals using %ENV within Perl. There is a syntax for *reading* search list logicals, but not creating them.

The reason for that is that in order to get past the 255-byte limitation on equivalence names, all of the elements of a search list are treated as one big long string so you effectively have 255 * 127 bytes for your value. In other words, if you assign a value to %ENV longer than 255 bytes, the pieces will be broken into chunks and stored as elements of the search list, then transparently pasted back together on lookup;

$ perl -e "$ENV{FOO} = 'Z' x (255 * 3);"
$ sho log foo
"FOO" = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZ" (LNM$PROCESS_TABLE)
= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZ"
= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZ"
$ perl -e "print $ENV{FOO};"
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
$

The exception is the special PERL5LIB logical that tells Perl where to look for libraries: that one is always treated as a genuine search list.

The problem at hand is probably best solved by VMS::Logical. FWIW, Perl 5.10.1 is current.
John Gillings
Honored Contributor

Re: Adding to DCL$PATH in PERL

>Running Perl does not spawn a sub process
> and thus a JOB logical is not required.

but what access mode does Perl use to define logical names? If they're in the process table at user mode, they will vaporise on image exit.

Use SHOW LOGICAL/FULL to include access mode, and add a wildcard to the end of the name to display the name at all access modes.

You might be able to SPAWN (ie Perl "system()") a SHOW LOGICAL/FULL command to see your user mode definition. Although you'll be looking at the process table of the subprocess, it should be a clone of the parent's table.
A crucible of informative mistakes
Craig A Berry
Honored Contributor

Re: Adding to DCL$PATH in PERL

When Perl is storing the environment array in logical names (not the only option) it sets those logicals in supervisor mode. This is handy when mixing and matching Perl with native VMS utilities and helps make Perl a viable DCL replacement in some circumstances. It causes trouble when scripts ported from Unix assume that the contents of the environment array disappear at program exit.

I've sometimes wondered whether we should implement a mode option so that people who want the logicals to go away at image run-down would have the ability to do so.
Cass Witkowski
Trusted Contributor

Re: Adding to DCL$PATH in PERL

Isn't that USER mode?