1PERLVMS(1)             Perl Programmers Reference Guide             PERLVMS(1)
2
3
4

NAME

6       perlvms - VMS-specific documentation for Perl
7

DESCRIPTION

9       Gathered below are notes describing details of Perl 5's behavior on
10       VMS.  They are a supplement to the regular Perl 5 documentation, so we
11       have focussed on the ways in which Perl 5 functions differently under
12       VMS than it does under Unix, and on the interactions between Perl and
13       the rest of the operating system.  We haven't tried to duplicate
14       complete descriptions of Perl features from the main Perl
15       documentation, which can be found in the [.pod] subdirectory of the
16       Perl distribution.
17
18       We hope these notes will save you from confusion and lost sleep when
19       writing Perl scripts on VMS.  If you find we've missed something you
20       think should appear here, please don't hesitate to drop a line to
21       vmsperl@perl.org.
22

Installation

24       Directions for building and installing Perl 5 can be found in the file
25       README.vms in the main source directory of the Perl distribution.
26

Organization of Perl Images

28   Core Images
29       During the build process, three Perl images are produced.  Miniperl.Exe
30       is an executable image which contains all of the basic functionality of
31       Perl, but cannot take advantage of Perl XS extensions and has a hard-
32       wired list of library locations for loading pure-Perl modules.  It is
33       used extensively to build and test Perl and various extensions, but is
34       not installed.
35
36       Most of the complete Perl resides in the shareable image PerlShr.Exe,
37       which provides a core to which the Perl executable image and all Perl
38       extensions are linked. It is generally located via the logical name
39       PERLSHR.  While it's possible to put the image in SYS$SHARE to make it
40       loadable, that's not recommended. And while you may wish to INSTALL the
41       image for performance reasons, you should not install it with
42       privileges; if you do, the result will not be what you expect as image
43       privileges are disabled during Perl start-up.
44
45       Finally, Perl.Exe is an executable image containing the main entry
46       point for Perl, as well as some initialization code.  It should be
47       placed in a public directory, and made world executable.  In order to
48       run Perl with command line arguments, you should define a foreign
49       command to invoke this image.
50
51   Perl Extensions
52       Perl extensions are packages which provide both XS and Perl code to add
53       new functionality to perl.  (XS is a meta-language which simplifies
54       writing C code which interacts with Perl, see perlxs for more details.)
55       The Perl code for an extension is treated like any other library module
56       - it's made available in your script through the appropriate "use" or
57       "require" statement, and usually defines a Perl package containing the
58       extension.
59
60       The portion of the extension provided by the XS code may be connected
61       to the rest of Perl in either of two ways.  In the static
62       configuration, the object code for the extension is linked directly
63       into PerlShr.Exe, and is initialized whenever Perl is invoked.  In the
64       dynamic configuration, the extension's machine code is placed into a
65       separate shareable image, which is mapped by Perl's DynaLoader when the
66       extension is "use"d or "require"d in your script.  This allows you to
67       maintain the extension as a separate entity, at the cost of keeping
68       track of the additional shareable image.  Most extensions can be set up
69       as either static or dynamic.
70
71       The source code for an extension usually resides in its own directory.
72       At least three files are generally provided: Extshortname.xs (where
73       Extshortname is the portion of the extension's name following the last
74       "::"), containing the XS code, Extshortname.pm, the Perl library module
75       for the extension, and Makefile.PL, a Perl script which uses the
76       "MakeMaker" library modules supplied with Perl to generate a
77       Descrip.MMS file for the extension.
78
79   Installing static extensions
80       Since static extensions are incorporated directly into PerlShr.Exe,
81       you'll have to rebuild Perl to incorporate a new extension.  You should
82       edit the main Descrip.MMS or Makefile you use to build Perl, adding the
83       extension's name to the "ext" macro, and the extension's object file to
84       the "extobj" macro.  You'll also need to build the extension's object
85       file, either by adding dependencies to the main Descrip.MMS, or using a
86       separate Descrip.MMS for the extension.  Then, rebuild PerlShr.Exe to
87       incorporate the new code.
88
89       Finally, you'll need to copy the extension's Perl library module to the
90       [.Extname] subdirectory under one of the directories in @INC, where
91       Extname is the name of the extension, with all "::" replaced by "."
92       (e.g.  the library module for extension Foo::Bar would be copied to a
93       [.Foo.Bar] subdirectory).
94
95   Installing dynamic extensions
96       In general, the distributed kit for a Perl extension includes a file
97       named Makefile.PL, which is a Perl program which is used to create a
98       Descrip.MMS file which can be used to build and install the files
99       required by the extension.  The kit should be unpacked into a directory
100       tree not under the main Perl source directory, and the procedure for
101       building the extension is simply
102
103           $ perl Makefile.PL  ! Create Descrip.MMS
104           $ mmk               ! Build necessary files
105           $ mmk test          ! Run test code, if supplied
106           $ mmk install       ! Install into public Perl tree
107
108       VMS support for this process in the current release of Perl is
109       sufficient to handle most extensions.  (See the MakeMaker documentation
110       for more details on installation options for extensions.)
111
112       •   the [.Lib.Auto.Arch$PVersExtname] subdirectory of one of the
113           directories in @INC (where PVers is the version of Perl you're
114           using, as supplied in $], with '.' converted to '_'), or
115
116       •   one of the directories in @INC, or
117
118       •   a directory which the extensions Perl library module passes to the
119           DynaLoader when asking it to map the shareable image, or
120
121Sys$Share or Sys$Library.
122
123       If the shareable image isn't in any of these places, you'll need to
124       define a logical name Extshortname, where Extshortname is the portion
125       of the extension's name after the last "::", which translates to the
126       full file specification of the shareable image.
127

File specifications

129   Syntax
130       We have tried to make Perl aware of both VMS-style and Unix-style file
131       specifications wherever possible.  You may use either style, or both,
132       on the command line and in scripts, but you may not combine the two
133       styles within a single file specification.  VMS Perl interprets Unix
134       pathnames in much the same way as the CRTL (e.g. the first component of
135       an absolute path is read as the device name for the VMS file
136       specification).  There are a set of functions provided in the
137       "VMS::Filespec" package for explicit interconversion between VMS and
138       Unix syntax; its documentation provides more details.
139
140       We've tried to minimize the dependence of Perl library modules on Unix
141       syntax, but you may find that some of these, as well as some scripts
142       written for Unix systems, will require that you use Unix syntax, since
143       they will assume that '/' is the directory separator, etc.  If you find
144       instances of this in the Perl distribution itself, please let us know,
145       so we can try to work around them.
146
147       Also when working on Perl programs on VMS, if you need a syntax in a
148       specific operating system format, then you need either to check the
149       appropriate DECC$ feature logical, or call a conversion routine to
150       force it to that format.
151
152       The feature logical name DECC$FILENAME_UNIX_REPORT modifies traditional
153       Perl behavior in the conversion of file specifications from Unix to VMS
154       format in order to follow the extended character handling rules now
155       expected by the CRTL.  Specifically, when this feature is in effect,
156       the "./.../" in a Unix path is now translated to "[.^.^.^.]" instead of
157       the traditional VMS "[...]".  To be compatible with what MakeMaker
158       expects, if a VMS path cannot be translated to a Unix path, it is
159       passed through unchanged, so "unixify("[...]")" will return "[...]".
160
161       There are several ambiguous cases where a conversion routine cannot
162       determine whether an input filename is in Unix format or in VMS format,
163       since now both VMS and Unix file specifications may have characters in
164       them that could be mistaken for syntax delimiters of the other type. So
165       some pathnames simply cannot be used in a mode that allows either type
166       of pathname to be present.  Perl will tend to assume that an ambiguous
167       filename is in Unix format.
168
169       Allowing "." as a version delimiter is simply incompatible with
170       determining whether a pathname is in VMS format or in Unix format with
171       extended file syntax.  There is no way to know whether "perl-5.8.6" is
172       a Unix "perl-5.8.6" or a VMS "perl-5.8;6" when passing it to unixify()
173       or vmsify().
174
175       The DECC$FILENAME_UNIX_REPORT logical name controls how Perl interprets
176       filenames to the extent that Perl uses the CRTL internally for many
177       purposes, and attempts to follow CRTL conventions for reporting
178       filenames.  The DECC$FILENAME_UNIX_ONLY feature differs in that it
179       expects all filenames passed to the C run-time to be already in Unix
180       format.  This feature is not yet supported in Perl since Perl uses
181       traditional OpenVMS file specifications internally and in the test
182       harness, and it is not yet clear whether this mode will be useful or
183       useable.  The feature logical name DECC$POSIX_COMPLIANT_PATHNAMES is
184       new with the RMS Symbolic Link SDK and included with OpenVMS v8.3, but
185       is not yet supported in Perl.
186
187   Filename Case
188       Perl enables DECC$EFS_CASE_PRESERVE and DECC$ARGV_PARSE_STYLE by
189       default.  Note that the latter only takes effect when extended parse is
190       set in the process in which Perl is running.  When these features are
191       explicitly disabled in the environment or the CRTL does not support
192       them, Perl follows the traditional CRTL behavior of downcasing command-
193       line arguments and returning file specifications in lower case only.
194
195       N. B.  It is very easy to get tripped up using a mixture of other
196       programs, external utilities, and Perl scripts that are in varying
197       states of being able to handle case preservation.  For example, a file
198       created by an older version of an archive utility or a build utility
199       such as MMK or MMS may generate a filename in all upper case even on an
200       ODS-5 volume.  If this filename is later retrieved by a Perl script or
201       module in a case preserving environment, that upper case name may not
202       match the mixed-case or lower-case expectations of the Perl code.  Your
203       best bet is to follow an all-or-nothing approach to case preservation:
204       either don't use it at all, or make sure your entire toolchain and
205       application environment support and use it.
206
207       OpenVMS Alpha v7.3-1 and later and all version of OpenVMS I64 support
208       case sensitivity as a process setting (see "SET PROCESS
209       /CASE_LOOKUP=SENSITIVE"). Perl does not currently support case
210       sensitivity on VMS, but it may in the future, so Perl programs should
211       use the "File::Spec->case_tolerant" method to determine the state, and
212       not the $^O variable.
213
214   Symbolic Links
215       When built on an ODS-5 volume with symbolic links enabled, Perl by
216       default supports symbolic links when the requisite support is available
217       in the filesystem and CRTL (generally 64-bit OpenVMS v8.3 and later).
218       There are a number of limitations and caveats to be aware of when
219       working with symbolic links on VMS.  Most notably, the target of a
220       valid symbolic link must be expressed as a Unix-style path and it must
221       exist on a volume visible from your POSIX root (see the "SHOW ROOT"
222       command in DCL help).  For further details on symbolic link
223       capabilities and requirements, see chapter 12 of the CRTL manual that
224       ships with OpenVMS v8.3 or later.
225
226   Wildcard expansion
227       File specifications containing wildcards are allowed both on the
228       command line and within Perl globs (e.g. "<*.c>").  If the wildcard
229       filespec uses VMS syntax, the resultant filespecs will follow VMS
230       syntax; if a Unix-style filespec is passed in, Unix-style filespecs
231       will be returned.  Similar to the behavior of wildcard globbing for a
232       Unix shell, one can escape command line wildcards with double quotation
233       marks """ around a perl program command line argument.  However, owing
234       to the stripping of """ characters carried out by the C handling of
235       argv you will need to escape a construct such as this one (in a
236       directory containing the files PERL.C, PERL.EXE, PERL.H, and PERL.OBJ):
237
238           $ perl -e "print join(' ',@ARGV)" perl.*
239           perl.c perl.exe perl.h perl.obj
240
241       in the following triple quoted manner:
242
243           $ perl -e "print join(' ',@ARGV)" """perl.*"""
244           perl.*
245
246       In both the case of unquoted command line arguments or in calls to
247       "glob()" VMS wildcard expansion is performed. (csh-style wildcard
248       expansion is available if you use "File::Glob::glob".)  If the wildcard
249       filespec contains a device or directory specification, then the
250       resultant filespecs will also contain a device and directory;
251       otherwise, device and directory information are removed.  VMS-style
252       resultant filespecs will contain a full device and directory, while
253       Unix-style resultant filespecs will contain only as much of a directory
254       path as was present in the input filespec.  For example, if your
255       default directory is Perl_Root:[000000], the expansion of "[.t]*.*"
256       will yield filespecs  like "perl_root:[t]base.dir", while the expansion
257       of "t/*/*" will yield filespecs like "t/base.dir".  (This is done to
258       match the behavior of glob expansion performed by Unix shells.)
259
260       Similarly, the resultant filespec will contain the file version only if
261       one was present in the input filespec.
262
263   Pipes
264       Input and output pipes to Perl filehandles are supported; the "file
265       name" is passed to lib$spawn() for asynchronous execution.  You should
266       be careful to close any pipes you have opened in a Perl script, lest
267       you leave any "orphaned" subprocesses around when Perl exits.
268
269       You may also use backticks to invoke a DCL subprocess, whose output is
270       used as the return value of the expression.  The string between the
271       backticks is handled as if it were the argument to the "system"
272       operator (see below).  In this case, Perl will wait for the subprocess
273       to complete before continuing.
274
275       The mailbox (MBX) that perl can create to communicate with a pipe
276       defaults to a buffer size of 8192 on 64-bit systems, 512 on VAX.  The
277       default buffer size is adjustable via the logical name PERL_MBX_SIZE
278       provided that the value falls between 128 and the SYSGEN parameter
279       MAXBUF inclusive.  For example, to set the mailbox size to 32767 use
280       "$ENV{'PERL_MBX_SIZE'} = 32767;" and then open and use pipe constructs.
281       An alternative would be to issue the command:
282
283           $ Define PERL_MBX_SIZE 32767
284
285       before running your wide record pipe program.  A larger value may
286       improve performance at the expense of the BYTLM UAF quota.
287

PERL5LIB and PERLLIB

289       The PERL5LIB and PERLLIB environment elements work as documented in
290       perl, except that the element separator is, by default, '|' instead of
291       ':'.  However, when running under a Unix shell as determined by the
292       logical name "GNV$UNIX_SHELL", the separator will be ':' as on Unix
293       systems. The directory specifications may use either VMS or Unix
294       syntax.
295

The Perl Forked Debugger

297       The Perl forked debugger places the debugger commands and output in a
298       separate X-11 terminal window so that commands and output from multiple
299       processes are not mixed together.
300
301       Perl on VMS supports an emulation of the forked debugger when Perl is
302       run on a VMS system that has X11 support installed.
303
304       To use the forked debugger, you need to have the default display set to
305       an X-11 Server and some environment variables set that Unix expects.
306
307       The forked debugger requires the environment variable "TERM" to be
308       "xterm", and the environment variable "DISPLAY" to exist.  "xterm" must
309       be in lower case.
310
311         $define TERM "xterm"
312
313         $define DISPLAY "hostname:0.0"
314
315       Currently the value of "DISPLAY" is ignored.  It is recommended that it
316       be set to be the hostname of the display, the server and screen in Unix
317       notation.  In the future the value of DISPLAY may be honored by Perl
318       instead of using the default display.
319
320       It may be helpful to always use the forked debugger so that script I/O
321       is separated from debugger I/O.  You can force the debugger to be
322       forked by assigning a value to the logical name <PERLDB_PIDS> that is
323       not a process identification number.
324
325         $define PERLDB_PIDS XXXX
326

PERL_VMS_EXCEPTION_DEBUG

328       The PERL_VMS_EXCEPTION_DEBUG being defined as "ENABLE" will cause the
329       VMS debugger to be invoked if a fatal exception that is not otherwise
330       handled is raised.  The purpose of this is to allow debugging of
331       internal Perl problems that would cause such a condition.
332
333       This allows the programmer to look at the execution stack and variables
334       to find out the cause of the exception.  As the debugger is being
335       invoked as the Perl interpreter is about to do a fatal exit, continuing
336       the execution in debug mode is usually not practical.
337
338       Starting Perl in the VMS debugger may change the program execution
339       profile in a way that such problems are not reproduced.
340
341       The "kill" function can be used to test this functionality from within
342       a program.
343
344       In typical VMS style, only the first letter of the value of this
345       logical name is actually checked in a case insensitive mode, and it is
346       considered enabled if it is the value "T","1" or "E".
347
348       This logical name must be defined before Perl is started.
349

Command line

351   I/O redirection and backgrounding
352       Perl for VMS supports redirection of input and output on the command
353       line, using a subset of Bourne shell syntax:
354
355       •   "<file" reads stdin from "file",
356
357       •   ">file" writes stdout to "file",
358
359       •   ">>file" appends stdout to "file",
360
361       •   "2>file" writes stderr to "file",
362
363       •   "2>>file" appends stderr to "file", and
364
365       •   "2>&1" redirects stderr to stdout.
366
367       In addition, output may be piped to a subprocess, using the character
368       '|'.  Anything after this character on the command line is passed to a
369       subprocess for execution; the subprocess takes the output of Perl as
370       its input.
371
372       Finally, if the command line ends with '&', the entire command is run
373       in the background as an asynchronous subprocess.
374
375   Command line switches
376       The following command line switches behave differently under VMS than
377       described in perlrun.  Note also that in order to pass uppercase
378       switches to Perl, you need to enclose them in double-quotes on the
379       command line, since the CRTL downcases all unquoted strings.
380
381       On newer 64 bit versions of OpenVMS, a process setting now controls if
382       the quoting is needed to preserve the case of command line arguments.
383
384       -i  If the "-i" switch is present but no extension for a backup copy is
385           given, then inplace editing creates a new version of a file; the
386           existing copy is not deleted.  (Note that if an extension is given,
387           an existing file is renamed to the backup file, as is the case
388           under other operating systems, so it does not remain as a previous
389           version under the original filename.)
390
391       -S  If the "-S" or "-"S"" switch is present and the script name does
392           not contain a directory, then Perl translates the logical name
393           DCL$PATH as a searchlist, using each translation as a directory in
394           which to look for the script.  In addition, if no file type is
395           specified, Perl looks in each directory for a file matching the
396           name specified, with a blank type, a type of .pl, and a type of
397           .com, in that order.
398
399       -u  The "-u" switch causes the VMS debugger to be invoked after the
400           Perl program is compiled, but before it has run.  It does not
401           create a core dump file.
402

Perl functions

404       As of the time this document was last revised, the following Perl
405       functions were implemented in the VMS port of Perl (functions marked
406       with * are discussed in more detail below):
407
408           file tests*, abs, alarm, atan, backticks*, binmode*, bless,
409           caller, chdir, chmod, chown, chomp, chop, chr,
410           close, closedir, cos, crypt*, defined, delete, die, do, dump*,
411           each, endgrent, endpwent, eof, eval, exec*, exists, exit, exp,
412           fileno, flock  getc, getgrent*, getgrgid*, getgrnam, getlogin,
413           getppid, getpwent*, getpwnam*, getpwuid*, glob, gmtime*, goto,
414           grep, hex, ioctl, import, index, int, join, keys, kill*,
415           last, lc, lcfirst, lchown*, length, link*, local, localtime, log,
416           lstat, m//, map, mkdir, my, next, no, oct, open, opendir, ord,
417           pack, pipe, pop, pos, print, printf, push, q//, qq//, qw//,
418           qx//*, quotemeta, rand, read, readdir, readlink*, redo, ref,
419           rename, require, reset, return, reverse, rewinddir, rindex,
420           rmdir, s///, scalar, seek, seekdir, select(internal),
421           select (system call)*, setgrent, setpwent, shift, sin, sleep,
422           socketpair, sort, splice, split, sprintf, sqrt, srand, stat,
423           study, substr, symlink*, sysread, system*, syswrite, tell,
424           telldir, tie, time, times*, tr///, uc, ucfirst, umask,
425           undef, unlink*, unpack, untie, unshift, use, utime*,
426           values, vec, wait, waitpid*, wantarray, warn, write, y///
427
428       The following functions were not implemented in the VMS port, and
429       calling them produces a fatal error (usually) or undefined behavior
430       (rarely, we hope):
431
432           chroot, dbmclose, dbmopen, fork*, getpgrp, getpriority,
433           msgctl, msgget, msgsend, msgrcv, semctl,
434           semget, semop, setpgrp, setpriority, shmctl, shmget,
435           shmread, shmwrite, syscall
436
437       The following functions are available on Perls compiled with Dec C 5.2
438       or greater and running VMS 7.0 or greater:
439
440           truncate
441
442       The following functions are available on Perls built on VMS 7.2 or
443       greater:
444
445           fcntl (without locking)
446
447       The following functions may or may not be implemented, depending on
448       what type of socket support you've built into your copy of Perl:
449
450           accept, bind, connect, getpeername,
451           gethostbyname, getnetbyname, getprotobyname,
452           getservbyname, gethostbyaddr, getnetbyaddr,
453           getprotobynumber, getservbyport, gethostent,
454           getnetent, getprotoent, getservent, sethostent,
455           setnetent, setprotoent, setservent, endhostent,
456           endnetent, endprotoent, endservent, getsockname,
457           getsockopt, listen, recv, select(system call)*,
458           send, setsockopt, shutdown, socket
459
460       The following function is available on Perls built on 64 bit OpenVMS
461       v8.2 with hard links enabled on an ODS-5 formatted build disk.  CRTL
462       support is in principle available as of OpenVMS v7.3-1, and better
463       configuration support could detect this.
464
465           link
466
467       The following functions are available on Perls built on 64 bit OpenVMS
468       v8.2 and later.  CRTL support is in principle available as of OpenVMS
469       v7.3-2, and better configuration support could detect this.
470
471          getgrgid, getgrnam, getpwnam, getpwuid,
472          setgrent, ttyname
473
474       The following functions are available on Perls built on 64 bit OpenVMS
475       v8.2 and later.
476
477          statvfs, socketpair
478
479       File tests
480           The tests "-b", "-B", "-c", "-C", "-d", "-e", "-f", "-o", "-M",
481           "-s", "-S", "-t", "-T", and "-z" work as advertised.  The return
482           values for "-r", "-w", and "-x" tell you whether you can actually
483           access the file; this may not reflect the UIC-based file
484           protections.  Since real and effective UIC don't differ under VMS,
485           "-O", "-R", "-W", and "-X" are equivalent to "-o", "-r", "-w", and
486           "-x".  Similarly, several other tests, including "-A", "-g", "-k",
487           "-l", "-p", and "-u", aren't particularly meaningful under VMS, and
488           the values returned by these tests reflect whatever your CRTL
489           "stat()" routine does to the equivalent bits in the st_mode field.
490           Finally, "-d" returns true if passed a device specification without
491           an explicit directory (e.g. "DUA1:"), as well as if passed a
492           directory.
493
494           There are DECC feature logical names AND ODS-5 volume attributes
495           that also control what values are returned for the date fields.
496
497           Note: Some sites have reported problems when using the file-access
498           tests ("-r", "-w", and "-x") on files accessed via DEC's DFS.
499           Specifically, since DFS does not currently provide access to the
500           extended file header of files on remote volumes, attempts to
501           examine the ACL fail, and the file tests will return false, with $!
502           indicating that the file does not exist.  You can use "stat" on
503           these files, since that checks UIC-based protection only, and then
504           manually check the appropriate bits, as defined by your C
505           compiler's stat.h, in the mode value it returns, if you need an
506           approximation of the file's protections.
507
508       backticks
509           Backticks create a subprocess, and pass the enclosed string to it
510           for execution as a DCL command.  Since the subprocess is created
511           directly via "lib$spawn()", any valid DCL command string may be
512           specified.
513
514       binmode FILEHANDLE
515           The "binmode" operator will attempt to insure that no translation
516           of carriage control occurs on input from or output to this
517           filehandle.  Since this involves reopening the file and then
518           restoring its file position indicator, if this function returns
519           FALSE, the underlying filehandle may no longer point to an open
520           file, or may point to a different position in the file than before
521           "binmode" was called.
522
523           Note that "binmode" is generally not necessary when using normal
524           filehandles; it is provided so that you can control I/O to existing
525           record-structured files when necessary.  You can also use the
526           "vmsfopen" function in the VMS::Stdio extension to gain finer
527           control of I/O to files and devices with different record
528           structures.
529
530       crypt PLAINTEXT, USER
531           The "crypt" operator uses the "sys$hash_password" system service to
532           generate the hashed representation of PLAINTEXT.  If USER is a
533           valid username, the algorithm and salt values are taken from that
534           user's UAF record.  If it is not, then the preferred algorithm and
535           a salt of 0 are used.  The quadword encrypted value is returned as
536           an 8-character string.
537
538           The value returned by "crypt" may be compared against the encrypted
539           password from the UAF returned by the "getpw*" functions, in order
540           to authenticate users.  If you're going to do this, remember that
541           the encrypted password in the UAF was generated using uppercase
542           username and password strings; you'll have to upcase the arguments
543           to "crypt" to insure that you'll get the proper value:
544
545               sub validate_passwd {
546                   my($user,$passwd) = @_;
547                   my($pwdhash);
548                   if ( !($pwdhash = (getpwnam($user))[1]) ||
549                          $pwdhash ne crypt("\U$passwd","\U$name") ) {
550                       intruder_alert($name);
551                   }
552                   return 1;
553               }
554
555       die "die" will force the native VMS exit status to be an SS$_ABORT code
556           if neither of the $! or $? status values are ones that would cause
557           the native status to be interpreted as being what VMS classifies as
558           SEVERE_ERROR severity for DCL error handling.
559
560           When "PERL_VMS_POSIX_EXIT" is active (see "$?" below), the native
561           VMS exit status value will have either one of the $! or $? or $^E
562           or the Unix value 255 encoded into it in a way that the effective
563           original value can be decoded by other programs written in C,
564           including Perl and the GNV package.  As per the normal non-VMS
565           behavior of "die" if either $! or $? are non-zero, one of those
566           values will be encoded into a native VMS status value.  If both of
567           the Unix status values are 0, and the $^E value is set one of ERROR
568           or SEVERE_ERROR severity, then the $^E value will be used as the
569           exit code as is.  If none of the above apply, the Unix value of 255
570           will be encoded into a native VMS exit status value.
571
572           Please note a significant difference in the behavior of "die" in
573           the "PERL_VMS_POSIX_EXIT" mode is that it does not force a VMS
574           SEVERE_ERROR status on exit.  The Unix exit values of 2 through 255
575           will be encoded in VMS status values with severity levels of
576           SUCCESS.  The Unix exit value of 1 will be encoded in a VMS status
577           value with a severity level of ERROR.  This is to be compatible
578           with how the VMS C library encodes these values.
579
580           The minimum severity level set by "die" in "PERL_VMS_POSIX_EXIT"
581           mode may be changed to be ERROR or higher in the future depending
582           on the results of testing and further review.
583
584           See "$?" for a description of the encoding of the Unix value to
585           produce a native VMS status containing it.
586
587       dump
588           Rather than causing Perl to abort and dump core, the "dump"
589           operator invokes the VMS debugger.  If you continue to execute the
590           Perl program under the debugger, control will be transferred to the
591           label specified as the argument to "dump", or, if no label was
592           specified, back to the beginning of the program.  All other state
593           of the program (e.g. values of variables, open file handles) are
594           not affected by calling "dump".
595
596       exec LIST
597           A call to "exec" will cause Perl to exit, and to invoke the command
598           given as an argument to "exec" via "lib$do_command".  If the
599           argument begins with '@' or '$' (other than as part of a filespec),
600           then it is executed as a DCL command.  Otherwise, the first token
601           on the command line is treated as the filespec of an image to run,
602           and an attempt is made to invoke it (using .Exe and the process
603           defaults to expand the filespec) and pass the rest of "exec"'s
604           argument to it as parameters.  If the token has no file type, and
605           matches a file with null type, then an attempt is made to determine
606           whether the file is an executable image which should be invoked
607           using "MCR" or a text file which should be passed to DCL as a
608           command procedure.
609
610       fork
611           While in principle the "fork" operator could be implemented via
612           (and with the same rather severe limitations as) the CRTL "vfork()"
613           routine, and while some internal support to do just that is in
614           place, the implementation has never been completed, making "fork"
615           currently unavailable.  A true kernel "fork()" is expected in a
616           future version of VMS, and the pseudo-fork based on interpreter
617           threads may be available in a future version of Perl on VMS (see
618           perlfork).  In the meantime, use "system", backticks, or piped
619           filehandles to create subprocesses.
620
621       getpwent
622       getpwnam
623       getpwuid
624           These operators obtain the information described in perlfunc, if
625           you have the privileges necessary to retrieve the named user's UAF
626           information via "sys$getuai".  If not, then only the $name, $uid,
627           and $gid items are returned.  The $dir item contains the login
628           directory in VMS syntax, while the $comment item contains the login
629           directory in Unix syntax. The $gcos item contains the owner field
630           from the UAF record.  The $quota item is not used.
631
632       gmtime
633           The "gmtime" operator will function properly if you have a working
634           CRTL "gmtime()" routine, or if the logical name
635           SYS$TIMEZONE_DIFFERENTIAL is defined as the number of seconds which
636           must be added to UTC to yield local time.  (This logical name is
637           defined automatically if you are running a version of VMS with
638           built-in UTC support.)  If neither of these cases is true, a
639           warning message is printed, and "undef" is returned.
640
641       kill
642           In most cases, "kill" is implemented via the undocumented system
643           service $SIGPRC, which has the same calling sequence as $FORCEX,
644           but throws an exception in the target process rather than forcing
645           it to call $EXIT.  Generally speaking, "kill" follows the behavior
646           of the CRTL's "kill()" function, but unlike that function can be
647           called from within a signal handler.  Also, unlike the "kill" in
648           some versions of the CRTL, Perl's "kill" checks the validity of the
649           signal passed in and returns an error rather than attempting to
650           send an unrecognized signal.
651
652           Also, negative signal values don't do anything special under VMS;
653           they're just converted to the corresponding positive value.
654
655       qx//
656           See the entry on "backticks" above.
657
658       select (system call)
659           If Perl was not built with socket support, the system call version
660           of "select" is not available at all.  If socket support is present,
661           then the system call version of "select" functions only for file
662           descriptors attached to sockets.  It will not provide information
663           about regular files or pipes, since the CRTL "select()" routine
664           does not provide this functionality.
665
666       stat EXPR
667           Since VMS keeps track of files according to a different scheme than
668           Unix, it's not really possible to represent the file's ID in the
669           "st_dev" and "st_ino" fields of a "struct stat".  Perl tries its
670           best, though, and the values it uses are pretty unlikely to be the
671           same for two different files.  We can't guarantee this, though, so
672           caveat scriptor.
673
674       system LIST
675           The "system" operator creates a subprocess, and passes its
676           arguments to the subprocess for execution as a DCL command.  Since
677           the subprocess is created directly via "lib$spawn()", any valid DCL
678           command string may be specified.  If the string begins with '@', it
679           is treated as a DCL command unconditionally.  Otherwise, if the
680           first token contains a character used as a delimiter in file
681           specification (e.g. ":" or "]"), an attempt is made to expand it
682           using  a default type of .Exe and the process defaults, and if
683           successful, the resulting file is invoked via "MCR". This allows
684           you to invoke an image directly simply by passing the file
685           specification to "system", a common Unixish idiom.  If the token
686           has no file type, and matches a file with null type, then an
687           attempt is made to determine whether the file is an executable
688           image which should be invoked using "MCR" or a text file which
689           should be passed to DCL as a command procedure.
690
691           If LIST consists of the empty string, "system" spawns an
692           interactive DCL subprocess, in the same fashion as typing SPAWN at
693           the DCL prompt.
694
695           Perl waits for the subprocess to complete before continuing
696           execution in the current process.  As described in perlfunc, the
697           return value of "system" is a fake "status" which follows POSIX
698           semantics unless the pragma "use vmsish 'status'" is in effect; see
699           the description of $? in this document for more detail.
700
701       time
702           The value returned by "time" is the offset in seconds from
703           01-JAN-1970 00:00:00 (just like the CRTL's times() routine), in
704           order to make life easier for code coming in from the POSIX/Unix
705           world.
706
707       times
708           The array returned by the "times" operator is divided up according
709           to the same rules the CRTL "times()" routine.  Therefore, the
710           "system time" elements will always be 0, since there is no
711           difference between "user time" and "system" time under VMS, and the
712           time accumulated by a subprocess may or may not appear separately
713           in the "child time" field, depending on whether "times()" keeps
714           track of subprocesses separately.  Note especially that the VAXCRTL
715           (at least) keeps track only of subprocesses spawned using "fork()"
716           and "exec()"; it will not accumulate the times of subprocesses
717           spawned via pipes, "system()", or backticks.
718
719       unlink LIST
720           "unlink" will delete the highest version of a file only; in order
721           to delete all versions, you need to say
722
723               1 while unlink LIST;
724
725           You may need to make this change to scripts written for a Unix
726           system which expect that after a call to "unlink", no files with
727           the names passed to "unlink" will exist.  (Note: This can be
728           changed at compile time; if you "use Config" and
729           $Config{'d_unlink_all_versions'} is "define", then "unlink" will
730           delete all versions of a file on the first call.)
731
732           "unlink" will delete a file if at all possible, even if it requires
733           changing file protection (though it won't try to change the
734           protection of the parent directory).  You can tell whether you've
735           got explicit delete access to a file by using the
736           "VMS::Filespec::candelete" operator.  For instance, in order to
737           delete only files to which you have delete access, you could say
738           something like
739
740               sub safe_unlink {
741                   my($file,$num);
742                   foreach $file (@_) {
743                       next unless VMS::Filespec::candelete($file);
744                       $num += unlink $file;
745                   }
746                   $num;
747               }
748
749           (or you could just use "VMS::Stdio::remove", if you've installed
750           the VMS::Stdio extension distributed with Perl). If "unlink" has to
751           change the file protection to delete the file, and you interrupt it
752           in midstream, the file may be left intact, but with a changed ACL
753           allowing you delete access.
754
755           This behavior of "unlink" is to be compatible with POSIX behavior
756           and not traditional VMS behavior.
757
758       utime LIST
759           This operator changes only the modification time of the file (VMS
760           revision date) on ODS-2 volumes and ODS-5 volumes without access
761           dates enabled. On ODS-5 volumes with access dates enabled, the true
762           access time is modified.
763
764       waitpid PID,FLAGS
765           If PID is a subprocess started by a piped "open()" (see open),
766           "waitpid" will wait for that subprocess, and return its final
767           status value in $?.  If PID is a subprocess created in some other
768           way (e.g.  SPAWNed before Perl was invoked), "waitpid" will simply
769           check once per second whether the process has completed, and return
770           when it has.  (If PID specifies a process that isn't a subprocess
771           of the current process, and you invoked Perl with the "-w" switch,
772           a warning will be issued.)
773
774           Returns PID on success, -1 on error.  The FLAGS argument is ignored
775           in all cases.
776

Perl variables

778       The following VMS-specific information applies to the indicated
779       "special" Perl variables, in addition to the general information in
780       perlvar.  Where there is a conflict, this information takes precedence.
781
782       %ENV
783           The operation of the %ENV array depends on the translation of the
784           logical name PERL_ENV_TABLES.  If defined, it should be a search
785           list, each element of which specifies a location for %ENV elements.
786           If you tell Perl to read or set the element "$ENV{"name"}", then
787           Perl uses the translations of PERL_ENV_TABLES as follows:
788
789           CRTL_ENV
790               This string tells Perl to consult the CRTL's internal "environ"
791               array of key-value pairs, using name as the key.  In most
792               cases, this contains only a few keys, but if Perl was invoked
793               via the C "exec[lv]e()" function, as is the case for some
794               embedded Perl applications or when running under a shell such
795               as GNV bash, the "environ" array may have been populated by the
796               calling program.
797
798           CLISYM_[LOCAL]
799               A string beginning with "CLISYM_"tells Perl to consult the
800               CLI's symbol tables, using name as the name of the symbol.
801               When reading an element of %ENV, the local symbol table is
802               scanned first, followed by the global symbol table..  The
803               characters following "CLISYM_" are significant when an element
804               of %ENV is set or deleted: if the complete string is
805               "CLISYM_LOCAL", the change is made in the local symbol table;
806               otherwise the global symbol table is changed.
807
808           Any other string
809               If an element of PERL_ENV_TABLES translates to any other
810               string, that string is used as the name of a logical name
811               table, which is consulted using name as the logical name.  The
812               normal search order of access modes is used.
813
814           PERL_ENV_TABLES is translated once when Perl starts up; any changes
815           you make while Perl is running do not affect the behavior of %ENV.
816           If PERL_ENV_TABLES is not defined, then Perl defaults to consulting
817           first the logical name tables specified by LNM$FILE_DEV, and then
818           the CRTL "environ" array.  This default order is reversed when the
819           logical name GNV$UNIX_SHELL is defined, such as when running under
820           GNV bash.
821
822           For operations on %ENV entries based on logical names or DCL
823           symbols, the key string is treated as if it were entirely
824           uppercase, regardless of the case actually specified in the Perl
825           expression. Entries in %ENV based on the CRTL's environ array
826           preserve the case of the key string when stored, and lookups are
827           case sensitive.
828
829           When an element of %ENV is read, the locations to which
830           PERL_ENV_TABLES points are checked in order, and the value obtained
831           from the first successful lookup is returned.  If the name of the
832           %ENV element contains a semi-colon, it and any characters after it
833           are removed.  These are ignored when the CRTL "environ" array or a
834           CLI symbol table is consulted.  However, the name is looked up in a
835           logical name table, the suffix after the semi-colon is treated as
836           the translation index to be used for the lookup.   This lets you
837           look up successive values for search list logical names.  For
838           instance, if you say
839
840              $  Define STORY  once,upon,a,time,there,was
841              $  perl -e "for ($i = 0; $i <= 6; $i++) " -
842              _$ -e "{ print $ENV{'story;'.$i},' '}"
843
844           Perl will print "ONCE UPON A TIME THERE WAS", assuming, of course,
845           that PERL_ENV_TABLES is set up so that the logical name "story" is
846           found, rather than a CLI symbol or CRTL "environ" element with the
847           same name.
848
849           When an element of %ENV is set to a defined string, the
850           corresponding definition is made in the location to which the first
851           translation of PERL_ENV_TABLES points.  If this causes a logical
852           name to be created, it is defined in supervisor mode.  (The same is
853           done if an existing logical name was defined in executive or kernel
854           mode; an existing user or supervisor mode logical name is reset to
855           the new value.)  If the value is an empty string, the logical
856           name's translation is defined as a single "NUL" (ASCII "\0")
857           character, since a logical name cannot translate to a zero-length
858           string.  (This restriction does not apply to CLI symbols or CRTL
859           "environ" values; they are set to the empty string.)
860
861           When an element of %ENV is set to "undef", the element is looked up
862           as if it were being read, and if it is found, it is deleted.  (An
863           item "deleted" from the CRTL "environ" array is set to the empty
864           string.)  Using "delete" to remove an element from %ENV has a
865           similar effect, but after the element is deleted, another attempt
866           is made to look up the element, so an inner-mode logical name or a
867           name in another location will replace the logical name just
868           deleted. In either case, only the first value found searching
869           PERL_ENV_TABLES is altered.  It is not possible at present to
870           define a search list logical name via %ENV.
871
872           The element $ENV{DEFAULT} is special: when read, it returns Perl's
873           current default device and directory, and when set, it resets them,
874           regardless of the definition of PERL_ENV_TABLES.  It cannot be
875           cleared or deleted; attempts to do so are silently ignored.
876
877           Note that if you want to pass on any elements of the C-local
878           environ array to a subprocess which isn't started by fork/exec, or
879           isn't running a C program, you can "promote" them to logical names
880           in the current process, which will then be inherited by all
881           subprocesses, by saying
882
883               foreach my $key (qw[C-local keys you want promoted]) {
884                   my $temp = $ENV{$key}; # read from C-local array
885                   $ENV{$key} = $temp;    # and define as logical name
886               }
887
888           (You can't just say $ENV{$key} = $ENV{$key}, since the Perl
889           optimizer is smart enough to elide the expression.)
890
891           Don't try to clear %ENV by saying "%ENV = ();", it will throw a
892           fatal error.  This is equivalent to doing the following from DCL:
893
894               DELETE/LOGICAL *
895
896           You can imagine how bad things would be if, for example, the
897           SYS$MANAGER or SYS$SYSTEM logical names were deleted.
898
899           At present, the first time you iterate over %ENV using "keys", or
900           "values",  you will incur a time penalty as all logical names are
901           read, in order to fully populate %ENV.  Subsequent iterations will
902           not reread logical names, so they won't be as slow, but they also
903           won't reflect any changes to logical name tables caused by other
904           programs.
905
906           You do need to be careful with the logical names representing
907           process-permanent files, such as "SYS$INPUT" and "SYS$OUTPUT".  The
908           translations for these logical names are prepended with a two-byte
909           binary value (0x1B 0x00) that needs to be stripped off if you want
910           to use it. (In previous versions of Perl it wasn't possible to get
911           the values of these logical names, as the null byte acted as an
912           end-of-string marker)
913
914       $!  The string value of $! is that returned by the CRTL's strerror()
915           function, so it will include the VMS message for VMS-specific
916           errors.  The numeric value of $! is the value of "errno", except if
917           errno is EVMSERR, in which case $! contains the value of
918           vaxc$errno.  Setting $!  always sets errno to the value specified.
919           If this value is EVMSERR, it also sets vaxc$errno to 4 (NONAME-F-
920           NOMSG), so that the string value of $! won't reflect the VMS error
921           message from before $! was set.
922
923       $^E This variable provides direct access to VMS status values in
924           vaxc$errno, which are often more specific than the generic Unix-
925           style error messages in $!.  Its numeric value is the value of
926           vaxc$errno, and its string value is the corresponding VMS message
927           string, as retrieved by sys$getmsg().  Setting $^E sets vaxc$errno
928           to the value specified.
929
930           While Perl attempts to keep the vaxc$errno value to be current, if
931           errno is not EVMSERR, it may not be from the current operation.
932
933       $?  The "status value" returned in $? is synthesized from the actual
934           exit status of the subprocess in a way that approximates POSIX
935           wait(5) semantics, in order to allow Perl programs to portably test
936           for successful completion of subprocesses.  The low order 8 bits of
937           $? are always 0 under VMS, since the termination status of a
938           process may or may not have been generated by an exception.
939
940           The next 8 bits contain the termination status of the program.
941
942           If the child process follows the convention of C programs compiled
943           with the _POSIX_EXIT macro set, the status value will contain the
944           actual value of 0 to 255 returned by that program on a normal exit.
945
946           With the _POSIX_EXIT macro set, the Unix exit value of zero is
947           represented as a VMS native status of 1, and the Unix values from 2
948           to 255 are encoded by the equation:
949
950              VMS_status = 0x35a000 + (unix_value * 8) + 1.
951
952           And in the special case of Unix value 1 the encoding is:
953
954              VMS_status = 0x35a000 + 8 + 2 + 0x10000000.
955
956           For other termination statuses, the severity portion of the
957           subprocess's exit status is used: if the severity was success or
958           informational, these bits are all 0; if the severity was warning,
959           they contain a value of 1; if the severity was error or fatal
960           error, they contain the actual severity bits, which turns out to be
961           a value of 2 for error and 4 for severe_error.  Fatal is another
962           term for the severe_error status.
963
964           As a result, $? will always be zero if the subprocess's exit status
965           indicated successful completion, and non-zero if a warning or error
966           occurred or a program compliant with encoding _POSIX_EXIT values
967           was run and set a status.
968
969           How can you tell the difference between a non-zero status that is
970           the result of a VMS native error status or an encoded Unix status?
971           You can not unless you look at the ${^CHILD_ERROR_NATIVE} value.
972           The ${^CHILD_ERROR_NATIVE} value returns the actual VMS status
973           value and check the severity bits. If the severity bits are equal
974           to 1, then if the numeric value for $? is between 2 and 255 or 0,
975           then $? accurately reflects a value passed back from a Unix
976           application.  If $? is 1, and the severity bits indicate a VMS
977           error (2), then $? is from a Unix application exit value.
978
979           In practice, Perl scripts that call programs that return
980           _POSIX_EXIT type status values will be expecting those values, and
981           programs that call traditional VMS programs will either be
982           expecting the previous behavior or just checking for a non-zero
983           status.
984
985           And success is always the value 0 in all behaviors.
986
987           When the actual VMS termination status of the child is an error,
988           internally the $! value will be set to the closest Unix errno value
989           to that error so that Perl scripts that test for error messages
990           will see the expected Unix style error message instead of a VMS
991           message.
992
993           Conversely, when setting $? in an END block, an attempt is made to
994           convert the POSIX value into a native status intelligible to the
995           operating system upon exiting Perl.  What this boils down to is
996           that setting $? to zero results in the generic success value
997           SS$_NORMAL, and setting $? to a non-zero value results in the
998           generic failure status SS$_ABORT.  See also "exit" in perlport.
999
1000           With the "PERL_VMS_POSIX_EXIT" logical name defined as "ENABLE",
1001           setting $? will cause the new value to be encoded into $^E so that
1002           either the original parent or child exit status values
1003            0 to 255 can be automatically recovered by C programs expecting
1004           _POSIX_EXIT behavior.  If both a parent and a child exit value are
1005           non-zero, then it will be assumed that this is actually a VMS
1006           native status value to be passed through.  The special value of
1007           0xFFFF is almost a NOOP as it will cause the current native VMS
1008           status in the C library to become the current native Perl VMS
1009           status, and is handled this way as it is known to not be a valid
1010           native VMS status value.  It is recommend that only values in the
1011           range of normal Unix parent or child status numbers, 0 to 255 are
1012           used.
1013
1014           The pragma "use vmsish 'status'" makes $? reflect the actual VMS
1015           exit status instead of the default emulation of POSIX status
1016           described above.  This pragma also disables the conversion of non-
1017           zero values to SS$_ABORT when setting $? in an END block (but zero
1018           will still be converted to SS$_NORMAL).
1019
1020           Do not use the pragma "use vmsish 'status'" with
1021           "PERL_VMS_POSIX_EXIT" enabled, as they are at times requesting
1022           conflicting actions and the consequence of ignoring this advice
1023           will be undefined to allow future improvements in the POSIX exit
1024           handling.
1025
1026           In general, with "PERL_VMS_POSIX_EXIT" enabled, more detailed
1027           information will be available in the exit status for DCL scripts or
1028           other native VMS tools, and will give the expected information for
1029           Posix programs.  It has not been made the default in order to
1030           preserve backward compatibility.
1031
1032           N.B. Setting "DECC$FILENAME_UNIX_REPORT" implicitly enables
1033           "PERL_VMS_POSIX_EXIT".
1034
1035       $|  Setting $| for an I/O stream causes data to be flushed all the way
1036           to disk on each write (i.e. not just to the underlying RMS buffers
1037           for a file).  In other words, it's equivalent to calling fflush()
1038           and fsync() from C.
1039

Standard modules with VMS-specific differences

1041   SDBM_File
1042       SDBM_File works properly on VMS. It has, however, one minor difference.
1043       The database directory file created has a .sdbm_dir extension rather
1044       than a .dir extension. .dir files are VMS filesystem directory files,
1045       and using them for other purposes could cause unacceptable problems.
1046

Revision date

1048       Please see the git repository for revision history.
1049

AUTHOR

1051       Charles Bailey  bailey@cor.newman.upenn.edu Craig Berry
1052       craigberry@mac.com Dan Sugalski  dan@sidhe.org John Malmberg
1053       wb8tyw@qsl.net
1054
1055
1056
1057perl v5.32.1                      2021-05-31                        PERLVMS(1)
Impressum