Seth Woolley's Man Viewer

perlvms(1) - perlvms - VMS-specific documentation for Perl - man 1 perlvms

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

PERLVMS(1)             Perl Programmers Reference Guide             PERLVMS(1)

       perlvms - VMS-specific documentation for Perl

       Gathered below are notes describing details of Perl 5's behavior on
       VMS.  They are a supplement to the regular Perl 5 documentation, so we
       have focussed on the ways in(1,8) which Perl 5 functions differently under
       VMS than it does under Unix, and on the interactions between Perl and
       the rest of the operating system.  We haven't tried to duplicate com-
       plete descriptions of Perl features from the main Perl documentation,
       which can be found in(1,8) the [.pod] subdirectory of the Perl distribution.

       We hope these notes will save you from confusion and lost sleep(1,3) when
       writing Perl scripts on VMS.  If you find we've missed something you
       think should appear here, please don't hesitate to drop a line to

       Directions for building and installing Perl 5 can be found in(1,8) the file(1,n)
       README.vms in(1,8) the main source directory of the Perl distribution..

Organization of Perl Images
       Core Images

       During the installation process, three Perl images are produced.
       Miniperl.Exe is an executable image which contains all of the basic
       functionality of Perl, but cannot take advantage of Perl extensions.
       It is used to generate several files needed to build the complete Perl
       and various extensions.  Once you've finished installing Perl, you can
       delete this image.

       Most of the complete Perl resides in(1,8) the shareable image PerlShr.Exe,
       which provides a core to which the Perl executable image and all Perl
       extensions are linked.  You should place this image in(1,8) Sys$Share, or
       define the logical name PerlShr to translate to the full file(1,n) specifi-
       cation of this image.  It should be world readable.  (Remember that if(3,n)
       a user has execute only access(2,5) to PerlShr, VMS will treat it as if(3,n) it
       were a privileged shareable image, and will therefore require all down-
       stream shareable images to be INSTALLed, etc.)

       Finally, Perl.Exe is an executable image containing the main entry
       point for Perl, as well as some initialization code.  It should be
       placed in(1,8) a public directory, and made world executable.  In order to
       run Perl with command line arguments, you should define a foreign com-
       mand to invoke this image.

       Perl Extensions

       Perl extensions are packages which provide both XS and Perl code to add
       new functionality to perl.  (XS is a meta-language which simplifies
       writing C code which interacts with Perl, see perlxs for more details.)
       The Perl code for an extension is treated like any other library module
       - it's made available in(1,8) your script through the appropriate "use" or
       "require" statement, and usually defines a Perl package containing the

       The portion of the extension provided by the XS code may be connected
       to the rest of Perl in(1,8) either of two ways.  In the static configura-
       tion, the object code for the extension is linked directly into Perl-
       Shr.Exe, and is initialized whenever Perl is invoked.  In the dynamic
       configuration, the extension's machine code is placed into a separate
       shareable image, which is mapped by Perl's DynaLoader when the exten-
       sion is "use"d or "require"d in(1,8) your script.  This allows you to main-
       tain the extension as a separate entity, at the cost of keeping track
       of the additional shareable image.  Most extensions can be set(7,n,1 builtins) up as
       either static or dynamic.

       The source code for an extension usually resides in(1,8) its own directory.
       At least three files are generally provided: Extshortname.xs (where
       Extshortname is the portion of the extension's name following the last
       "::"), containing the XS code,, the Perl library module
       for the extension, and Makefile.PL, a Perl script which uses the "Make-
       Maker" library modules supplied with Perl to generate a Descrip.MMS
       file(1,n) for the extension.

       Installing static extensions

       Since static extensions are incorporated directly into PerlShr.Exe,
       you'll have to rebuild Perl to incorporate a new extension.  You should
       edit the main Descrip.MMS or Makefile you use to build Perl, adding the
       extension's name to the "ext" macro, and the extension's object file(1,n) to
       the "extobj" macro.  You'll also need to build the extension's object
       file(1,n), either by adding dependencies to the main Descrip.MMS, or using a
       separate Descrip.MMS for the extension.  Then, rebuild PerlShr.Exe to
       incorporate the new code.

       Finally, you'll need to copy the extension's Perl library module to the
       [.Extname] subdirectory under one of the directories in(1,8) @INC, where
       Extname is the name of the extension, with all "::" replaced by "."
       (e.g.  the library module for extension Foo::Bar would be copied to a
       [.Foo.Bar] subdirectory).

       Installing dynamic extensions

       In general, the distributed kit for a Perl extension includes a file(1,n)
       named(5,8) Makefile.PL, which is a Perl program which is used to create a
       Descrip.MMS file(1,n) which can be used to build and install the files
       required by the extension.  The kit should be unpacked into a directory
       tree not under the main Perl source directory, and the procedure for
       building the extension is simply

           $ perl Makefile.PL  ! Create Descrip.MMS
           $ mmk               ! Build necessary files
           $ mmk test          ! Run test code, if(3,n) supplied
           $ mmk install       ! Install into public Perl tree

       N.B. The procedure by which extensions are built and tested creates
       several levels (at least 4) under the directory in(1,8) which the exten-
       sion's source files live.  For this reason if(3,n) you are runnning a ver-
       sion(1,3,5) of VMS prior to V7.1 you shouldn't nest the source directory too
       deeply in(1,8) your directory structure lest you exceed RMS' maximum of 8
       levels of subdirectory in(1,8) a filespec.  (You can use rooted logical
       names to get another 8 levels of nesting, if(3,n) you can't place the files
       near the top of the physical directory structure.)

       VMS support for this process in(1,8) the current release of Perl is suffi-
       cient to handle most extensions.  However, it does not yet recognize
       extra libraries required to build shareable images which are part of an
       extension, so these must be added to the linker options file(1,n) for the
       extension by hand.  For instance, if(3,n) the PGPLOT extension to Perl
       requires the PGPLOTSHR.EXE shareable image in(1,8) order to properly link(1,2)
       the Perl extension, then the line "PGPLOTSHR/Share" must be added to
       the linker options file(1,n) PGPLOT.Opt produced during the build process
       for the Perl extension.

       By default, the shareable image for an extension is placed in(1,8) the
       [.lib.site_perl.autoArch.Extname] directory of the installed Perl
       directory tree (where Arch is VMS_VAX or VMS_AXP, and Extname is the
       name of the extension, with each "::" translated to ".").  (See the
       MakeMaker documentation for more details on installation options for
       extensions.)  However, it can be manually placed in(1,8) any of several

          the [.Lib.Auto.Arch$PVersExtname] subdirectory of one of the direc-
           tories in(1,8) @INC (where PVers is the version(1,3,5) of Perl you're using, as
           supplied in(1,8) $], with '.' converted to '_'), or

          one of the directories in(1,8) @INC, or

          a directory which the extensions Perl library module passes to the
           DynaLoader when asking it to map the shareable image, or

          Sys$Share or Sys$Library.

       If the shareable image isn't in(1,8) any of these places, you'll need to
       define a logical name Extshortname, where Extshortname is the portion
       of the extension's name after the last "::", which translates to the
       full file(1,n) specification of the shareable image.

File specifications

       We have tried to make Perl aware of both VMS-style and Unix- style file(1,n)
       specifications wherever possible.  You may use either style, or both,
       on the command line and in(1,8) scripts, but you may not combine the two
       styles within a single file(1,n) specification.  VMS Perl interprets Unix
       pathnames in(1,8) much the same way as the CRTL (e.g. the first component of
       an absolute path is read(2,n,1 builtins) as the device name for the VMS file(1,n) specifica-
       tion).  There are a set(7,n,1 builtins) of functions provided in(1,8) the "VMS::Filespec"
       package for explicit interconversion between VMS and Unix syntax; its
       documentation provides more details.

       Filenames are, of course, still case-insensitive.  For consistency,
       most Perl routines return  filespecs using lower case letters only,
       regardless of the case used in(1,8) the arguments passed to them.  (This is
       true  only when running under VMS; Perl respects the case-sensitivity
       of OSs like Unix.)

       We've tried to minimize the dependence of Perl library modules on Unix
       syntax, but you may find that some of these, as well as some scripts
       written for Unix systems, will require that you use Unix syntax, since
       they will assume that '/' is the directory separator, etc.  If you find
       instances of this in(1,8) the Perl distribution itself, please let us know,
       so we can try to work around them.

       Wildcard expansion

       File specifications containing wildcards are allowed both on the com-
       mand line and within Perl globs (e.g. "<*.c>").  If the wildcard file-
       spec uses VMS syntax, the resultant filespecs will follow VMS syntax;
       if(3,n) a Unix-style filespec is passed in(1,8), Unix-style filespecs will be
       returned.  Similar to the behavior of wildcard globbing for a Unix
       shell, one can escape command line wildcards with double quotation
       marks """ around a perl program command line argument.  However, owing
       to the stripping of """ characters carried out by the C handling of
       argv you will need to escape a construct such as this one (in(1,8) a direc-
       tory containing the files PERL.C, PERL.EXE, PERL.H, and PERL.OBJ):

           $ perl -e "print join(1,n)(' ',@ARGV)" perl.*
           perl.c perl.exe perl.h perl.obj

       in(1,8) the following triple quoted manner:

           $ perl -e "print join(1,n)(' ',@ARGV)" """perl.*"""

       In both the case of unquoted command line arguments or in(1,8) calls to
       "glob(1,3,7,n)()" VMS wildcard expansion is performed. (csh-style wildcard
       expansion is available if(3,n) you use "File::Glob::glob".)  If the wildcard
       filespec contains a device or directory specification, then the resul-
       tant filespecs will also contain a device and directory; otherwise,
       device and directory information are removed.  VMS-style resultant
       filespecs will contain a full device and directory, while Unix-style
       resultant filespecs will contain only as much of a directory path as
       was present in(1,8) the input filespec.  For example, if(3,n) your default direc-
       tory is Perl_Root:[000000], the expansion of "[.t]*.*" will yield file-
       specs  like "perl_root:[t]base.dir", while the expansion of "t/*/*"
       will yield filespecs like "t/base.dir".  (This is done to match the
       behavior of glob(1,3,7,n) expansion performed by Unix shells.)

       Similarly, the resultant filespec will contain the file(1,n) version(1,3,5) only if(3,n)
       one was present in(1,8) the input filespec.


       Input and output pipes to Perl filehandles are supported; the "file(1,n)
       name" is passed to lib$spawn() for asynchronous execution.  You should
       be careful to close(2,7,n) any pipes you have opened in(1,8) a Perl script, lest
       you leave any "orphaned" subprocesses around when Perl exits.

       You may also use backticks to invoke a DCL subprocess, whose output is
       used as the return value of the expression.  The string(3,n) between the
       backticks is handled as if(3,n) it were the argument to the "system" opera-
       tor (see below).  In this case, Perl will wait for the subprocess to
       complete before continuing.

       The mailbox (MBX) that perl can create to communicate with a pipe(2,8)
       defaults to a buffer size of 512.  The default buffer size is
       adjustable via the logical name PERL_MBX_SIZE provided that the value
       falls between 128 and the SYSGEN parameter MAXBUF inclusive.  For exam-
       ple, to double the MBX size from the default within a Perl program, use
       "$ENV{'PERL_MBX_SIZE'} = 1024;" and then open(2,3,n) and use pipe(2,8) constructs.
       An alternative would be to issue the command:

           $ Define PERL_MBX_SIZE 1024

       before running your wide record pipe(2,8) program.  A larger value may
       improve performance at the expense of the BYTLM UAF quota.

       The PERL5LIB and PERLLIB logical names work as documented in(1,8) perl,
       except that the element separator is '|' instead of ':'.  The directory
       specifications may use either VMS or Unix syntax.

Command line
       I/O redirection and backgrounding

       Perl for VMS supports redirection of input and output on the command
       line, using a subset of Bourne shell syntax:

          "<file(1,n)" reads stdin from "file(1,n)",

          ">file(1,n)" writes stdout to "file(1,n)",

          ">>file(1,n)" appends stdout to "file(1,n)",

          "2>file(1,n)" writes stderr to "file(1,n)",

          "2>>file(1,n)" appends stderr to "file(1,n)", and

          "2>&1" redirects stderr to stdout.

       In addition, output may be piped to a subprocess, using the character
       '|'.  Anything after this character on the command line is passed to a
       subprocess for execution; the subprocess takes the output of Perl as
       its input.

       Finally, if(3,n) the command line ends with '&', the entire command is run
       in(1,8) the background as an asynchronous subprocess.

       Command line switches

       The following command line switches behave differently under VMS than
       described in(1,8) perlrun.  Note also that in(1,8) order to pass uppercase
       switches to Perl, you need to enclose them in(1,8) double-quotes on the com-
       mand line, since the CRTL downcases all unquoted strings.

       -i  If the "-i" switch(1,n) is present but no extension for a backup copy is
           given, then inplace editing creates a new version(1,3,5) of a file(1,n); the
           existing copy is not deleted.  (Note that if(3,n) an extension is given,
           an existing file(1,n) is renamed to the backup file(1,n), as is the case
           under other operating systems, so it does not remain as a previous
           version(1,3,5) under the original filename.)

       -S  If the "-S" or "-"S"" switch(1,n) is present and the script name does
           not contain a directory, then Perl translates the logical name
           DCL$PATH as a searchlist, using each translation as a directory in(1,8)
           which to look(1,8,3 Search::Dict) for the script.  In addition, if(3,n) no file(1,n) type is
           specified, Perl looks in(1,8) each directory for a file(1,n) matching the
           name specified, with a blank type, a type of .pl, and a type of
           .com, in(1,8) that order.

       -u  The "-u" switch(1,n) causes the VMS debugger to be invoked after the
           Perl program is compiled, but before it has run.  It does not cre-
           ate a core dump file.

Perl functions
       As of the time(1,2,n) this document was last revised, the following Perl func-
       tions were implemented in(1,8) the VMS port of Perl (functions marked with *
       are discussed in(1,8) more detail below):

           file(1,n) tests*, abs, alarm(1,2), atan, backticks*, binmode*, bless,
           caller, chdir, chmod(1,2), chown(1,2), chomp, chop, chr,
           close(2,7,n), closedir, cos, crypt*, defined, delete,
           die, do, dump*, each, endpwent, eof, eval, exec(3,n,1 builtins)*,
           exists, exit(3,n,1 builtins), exp, fileno, getc, getlogin, getppid,
           getpwent*, getpwnam*, getpwuid*, glob(1,3,7,n), gmtime*, goto,
           grep, hex, import, index, int, join(1,n), keys, kill(1,2,1 builtins)*,
           last, lc, lcfirst, length, local, localtime, log, m//,
           map, mkdir(1,2), my, next, no, oct, open(2,3,n), opendir, ord, pack(3,n,n pack-old),
           pipe(2,8), pop, pos, print, printf(1,3,1 builtins), push, q//, qq//, qw//,
           qx//*, quotemeta, rand(1,3), read(2,n,1 builtins), readdir(2,3), redo, ref, rename(1,2,n),
           require, reset(1,7,1 tput), return, reverse, rewinddir, rindex,
           rmdir(1,2), s///, scalar, seek, seekdir, select(2,7,2 select_tut)(internal),
           select(2,7,2 select_tut) (system call)*, setpwent, shift, sin, sleep(1,3),
           sort(1,3), splice, split(1,n), sprintf, sqrt, srand, stat(1,2),
           study, substr, sysread, system*, syswrite, tell,
           telldir, tie, time(1,2,n), times*, tr///, uc, ucfirst, umask,
           undef, unlink(1,2)*, unpack, untie, unshift, use, utime*,
           values, vec, wait, waitpid*, wantarray, warn, write(1,2), y///

       The following functions were not implemented in(1,8) the VMS port, and call-
       ing them produces a fatal error(8,n) (usually) or undefined behavior
       (rarely, we hope):

           chroot(1,2), dbmclose, dbmopen, flock(1,2), fork*,
           getpgrp, getpriority, getgrent, getgrgid,
           getgrnam, setgrent, endgrent, ioctl, link(1,2), lstat,
           msgctl, msgget, msgsend, msgrcv, readlink(1,2), semctl,
           semget, semop, setpgrp, setpriority, shmctl, shmget,
           shmread, shmwrite, socketpair, symlink, syscall

       The following functions are available on Perls compiled with Dec C 5.2
       or greater and running VMS 7.0 or greater:


       The following functions are available on Perls built on VMS 7.2 or

           fcntl (without locking)

       The following functions may or may not be implemented, depending on
       what type of socket(2,7,n) support you've built into your copy of Perl:

           accept(2,8), bind(2,n,1 builtins), connect, getpeername(1,2),
           gethostbyname, getnetbyname, getprotobyname,
           getservbyname, gethostbyaddr, getnetbyaddr,
           getprotobynumber, getservbyport, gethostent,
           getnetent, getprotoent, getservent, sethostent,
           setnetent, setprotoent, setservent, endhostent,
           endnetent, endprotoent, endservent, getsockname,
           getsockopt, listen(1,2,7), recv, select(2,7,2 select_tut)(system call)*,
           send(2,n), setsockopt, shutdown(2,8), socket(2,7,n)

       File tests
           The tests "-b", "-B", "-c", "-C", "-d", "-e", "-f", "-o", "-M",
           "-s", "-S", "-t", "-T", and "-z" work as advertised.  The return
           values for "-r", "-w", and "-x" tell you whether you can actually
           access(2,5) the file(1,n); this may not reflect the UIC-based file(1,n) protec-
           tions.  Since real and effective UIC don't differ under VMS, "-O",
           "-R", "-W", and "-X" are equivalent to "-o", "-r", "-w", and "-x".
           Similarly, several other tests, including "-A", "-g", "-k", "-l",
           "-p", and "-u", aren't particularly meaningful under VMS, and the
           values returned by these tests reflect whatever your CRTL "stat(1,2)()"
           routine does to the equivalent bits in(1,8) the st_mode field.  Finally,
           "-d" returns true if(3,n) passed a device specification without an
           explicit directory (e.g. "DUA1:"), as well as if(3,n) passed a direc-

           Note: Some sites have reported problems when using the file-access
           tests ("-r", "-w", and "-x") on files accessed via DEC's DFS.
           Specifically, since DFS does not currently provide access(2,5) to the
           extended file(1,n) header of files on remote volumes, attempts to exam-
           ine the ACL fail, and the file(1,n) tests will return false, with $!
           indicating that the file(1,n) does not exist.  You can use "stat(1,2)" on
           these files, since that checks UIC-based protection only, and then
           manually check the appropriate bits, as defined by your C com-
           piler's stat.h, in(1,8) the mode value it returns, if(3,n) you need an
           approximation of the file(1,n)'s protections.

           Backticks create a subprocess, and pass the enclosed string(3,n) to it
           for execution as a DCL command.  Since the subprocess is created
           directly via "lib$spawn()", any valid DCL command string(3,n) may be

       binmode FILEHANDLE
           The "binmode" operator will attempt to insure that no translation
           of carriage control occurs on input from or output to this filehan-
           dle.  Since this involves reopening the file(1,n) and then restoring its
           file(1,n) position indicator, if(3,n) this function returns FALSE, the under-
           lying filehandle may no longer point to an open(2,3,n) file(1,n), or may point
           to a different position in(1,8) the file(1,n) than before "binmode" was

           Note that "binmode" is generally not necessary when using normal
           filehandles; it is provided so that you can control I/O to existing
           record-structured files when necessary.  You can also use the "vms-
           fopen" function in(1,8) the VMS::Stdio extension to gain finer control
           of I/O to files and devices with different record structures.

       crypt PLAINTEXT, USER
           The "crypt" operator uses the "sys$hash_password" system service to
           generate the hashed representation of PLAINTEXT.  If USER is a
           valid username, the algorithm and salt values are taken from that
           user's UAF record.  If it is not, then the preferred algorithm and
           a salt of 0 are used.  The quadword encrypted value is returned as
           an 8-character string.

           The value returned by "crypt" may be compared against the encrypted
           password from the UAF returned by the "getpw*" functions, in(1,8) order
           to authenticate users.  If you're going to do this, remember that
           the encrypted password in(1,8) the UAF was generated using uppercase
           username and password strings; you'll have to upcase the arguments
           to "crypt" to insure that you'll get the proper value:

               sub validate_passwd {
                   my($user,$passwd(1,5)) = @_;
                   if(3,n) ( !($pwdhash = (getpwnam($user))[1]) ||
                          $pwdhash ne crypt("\U$passwd(1,5)","\U$name") ) {
                   return 1;

           Rather than causing Perl to abort(3,7) and dump core, the "dump" opera-
           tor invokes the VMS debugger.  If you continue to execute the Perl
           program under the debugger, control will be transferred to the
           label specified as the argument to "dump", or, if(3,n) no label was
           specified, back to the beginning of the program.  All other state
           of the program (e.g. values of variables, open(2,3,n) file(1,n) handles) are
           not affected by calling "dump".

       exec(3,n,1 builtins) LIST
           A call to "exec(3,n,1 builtins)" will cause Perl to exit(3,n,1 builtins), and to invoke the command
           given as an argument to "exec(3,n,1 builtins)" via "lib$do_command".  If the argu-
           ment begins with '@' or '$' (other than as part of a filespec),
           then it is executed as a DCL command.  Otherwise, the first token
           on the command line is treated as the filespec of an image to run,
           and an attempt is made to invoke it (using .Exe and the process
           defaults to expand the filespec) and pass the rest of "exec(3,n,1 builtins)"'s
           argument to it as parameters.  If the token has no file(1,n) type, and
           matches a file(1,n) with null type, then an attempt is made to determine
           whether the file(1,n) is an executable image which should be invoked
           using "MCR" or a text file(1,n) which should be passed to DCL as a com-
           mand procedure.

           While in(1,8) principle the "fork" operator could be implemented via
           (and with the same rather severe limitations as) the CRTL "vfork()"
           routine, and while some internal support to do just that is in(1,8)
           place, the implementation has never been completed, making "fork"
           currently unavailable.  A true kernel "fork()" is expected in(1,8) a
           future version(1,3,5) of VMS, and the pseudo-fork based on interpreter
           threads may be available in(1,8) a future version(1,3,5) of Perl on VMS (see
           perlfork).  In the meantime, use "system", backticks, or piped
           filehandles to create subprocesses.

           These operators obtain the information described in(1,8) perlfunc, if(3,n)
           you have the privileges necessary to retrieve the named(5,8) user's UAF
           information via "sys$getuai".  If not, then only the $name, $uid,
           and $gid items are returned.  The $dir item contains the login(1,3,5)
           directory in(1,8) VMS syntax, while the $comment item contains the login(1,3,5)
           directory in(1,8) Unix syntax. The $gcos item contains the owner field
           from the UAF record.  The $quota(1,8) item is not used.

           The "gmtime" operator will function properly if(3,n) you have a working
           CRTL "gmtime()" routine, or if(3,n) the logical name SYS$TIMEZONE_DIF-
           FERENTIAL is defined as the number of seconds which must be added
           to UTC to yield local time.  (This logical name is defined automat-
           ically if(3,n) you are running a version(1,3,5) of VMS with built-in UTC sup-
           port.)  If neither of these cases is true, a warning message is
           printed, and "undef" is returned.

       kill(1,2,1 builtins)
           In most cases, "kill(1,2,1 builtins)" is implemented via the CRTL's "kill(1,2,1 builtins)()" func-
           tion, so it will behave according to that function's documentation.
           If you send(2,n) a SIGKILL, however, the $DELPRC system service is
           called directly.  This insures that the target process is actually
           deleted, if(3,n) at all possible.  (The CRTL's "kill(1,2,1 builtins)()" function is
           presently implemented via $FORCEX, which is ignored by supervisor-
           mode images like DCL.)

           Also, negative signal(2,7) values don't do anything special under VMS;
           they're just converted to the corresponding positive value.

           See the entry on "backticks" above.

       select(2,7,2 select_tut) (system call)
           If Perl was not built with socket(2,7,n) support, the system call version(1,3,5)
           of "select(2,7,2 select_tut)" is not available at all.  If socket(2,7,n) support is present,
           then the system call version(1,3,5) of "select(2,7,2 select_tut)" functions only for file(1,n)
           descriptors attached to sockets.  It will not provide information
           about regular files or pipes, since the CRTL "select(2,7,2 select_tut)()" routine
           does not provide this functionality.

       stat(1,2) EXPR
           Since VMS keeps track of files according to a different scheme than
           Unix, it's not really possible to represent the file(1,n)'s ID in(1,8) the
           "st_dev" and "st_ino" fields of a "struct stat(1,2)".  Perl tries its
           best, though, and the values it uses are pretty unlikely to be the
           same for two different files.  We can't guarantee this, though, so
           caveat scriptor.

       system LIST
           The "system" operator creates a subprocess, and passes its argu-
           ments to the subprocess for execution as a DCL command.  Since the
           subprocess is created directly via "lib$spawn()", any valid DCL
           command string(3,n) may be specified.  If the string(3,n) begins with '@', it
           is treated as a DCL command unconditionally.  Otherwise, if(3,n) the
           first token contains a character used as a delimiter in(1,8) file(1,n) speci-
           fication (e.g. ":" or "]"), an attempt is made to expand it using
           a default type of .Exe and the process defaults, and if(3,n) successful,
           the resulting file(1,n) is invoked via "MCR". This allows you to invoke
           an image directly simply by passing the file(1,n) specification to "sys-
           tem", a common Unixish idiom.  If the token has no file(1,n) type, and
           matches a file(1,n) with null type, then an attempt is made to determine
           whether the file(1,n) is an executable image which should be invoked
           using "MCR" or a text file(1,n) which should be passed to DCL as a com-
           mand procedure.

           If LIST consists of the empty string(3,n), "system" spawns an interac-
           tive DCL subprocess, in(1,8) the same fashion as typing SPAWN at the DCL

           Perl waits for the subprocess to complete before continuing execu-
           tion in(1,8) the current process.  As described in(1,8) perlfunc, the return
           value of "system" is a fake "status" which follows POSIX semantics
           unless the pragma "use vmsish 'status'" is in(1,8) effect; see the
           description of $? in(1,8) this document for more detail.

           The value returned by "time(1,2,n)" is the offset in(1,8) seconds from
           01-JAN-1970 00:00:00 (just like the CRTL's times() routine), in(1,8)
           order to make life easier for code coming in(1,8) from the POSIX/Unix

           The array returned by the "times" operator is divided up according
           to the same rules the CRTL "times()" routine.  Therefore, the "sys-
           tem time(1,2,n)" elements will always be 0, since there is no difference
           between "user time(1,2,n)" and "system" time(1,2,n) under VMS, and the time(1,2,n) accu-
           mulated by a subprocess may or may not appear separately in(1,8) the
           "child time(1,2,n)" field, depending on whether times keeps track of sub-
           processes separately.  Note especially that the VAXCRTL (at least)
           keeps track only of subprocesses spawned using fork and exec(3,n,1 builtins); it
           will not accumulate the times of subprocesses spawned via pipes,
           system, or backticks.

       unlink(1,2) LIST
           "unlink(1,2)" will delete the highest version(1,3,5) of a file(1,n) only; in(1,8) order
           to delete all versions, you need to say

               1 while unlink(1,2) LIST;

           You may need to make this change to scripts written for a Unix sys-
           tem which expect that after a call to "unlink(1,2)", no files with the
           names passed to "unlink(1,2)" will exist.  (Note: This can be changed at
           compile time(1,2,n); if(3,n) you "use Config" and $Config{'d_unlink_all_ver-
           sions'} is "define", then "unlink(1,2)" will delete all versions of a
           file(1,n) on the first call.)

           "unlink(1,2)" will delete a file(1,n) if(3,n) at all possible, even if(3,n) it requires
           changing file(1,n) protection (though it won't try to change the protec-
           tion of the parent directory).  You can tell whether you've got
           explicit delete access(2,5) to a file(1,n) by using the "VMS::Filespec::can-
           delete" operator.  For instance, in(1,8) order to delete only files to
           which you have delete access(2,5), you could say something like

               sub safe_unlink {
                   foreach $file(1,n) (@_) {
                       next unless VMS::Filespec::candelete($file(1,n));
                       $num += unlink(1,2) $file(1,n);

           (or you could just use "VMS::Stdio::remove", if(3,n) you've installed
           the VMS::Stdio extension distributed with Perl). If "unlink(1,2)" has to
           change the file(1,n) protection to delete the file(1,n), and you interrupt it
           in(1,8) midstream, the file(1,n) may be left intact, but with a changed ACL
           allowing you delete access.

       utime LIST
           Since ODS-2, the VMS file(1,n) structure for disk files, does not keep
           track of access(2,5) times, this operator changes only the modification
           time(1,2,n) of the file(1,n) (VMS revision date).

       waitpid PID,FLAGS
           If PID is a subprocess started by a piped "open(2,3,n)()" (see open(2,3,n)),
           "waitpid" will wait for that subprocess, and return its final sta-
           tus value in(1,8) $?.  If PID is a subprocess created in(1,8) some other way
           (e.g.  SPAWNed before Perl was invoked), "waitpid" will simply
           check once per second whether the process has completed, and return
           when it has.  (If PID specifies a process that isn't a subprocess
           of the current process, and you invoked Perl with the "-w" switch(1,n),
           a warning will be issued.)

           Returns PID on success, -1 on error.  The FLAGS argument is ignored
           in(1,8) all cases.

Perl variables
       The following VMS-specific information applies to the indicated "spe-
       cial" Perl variables, in(1,8) addition to the general information in(1,8) perl-
       var.  Where there is a conflict, this information takes precedence.

           The operation of the %ENV array depends on the translation of the
           logical name PERL_ENV_TABLES.  If defined, it should be a search
           list, each element of which specifies a location for %ENV elements.
           If you tell Perl to read(2,n,1 builtins) or set(7,n,1 builtins) the element "$ENV{"name"}", then
           Perl uses the translations of PERL_ENV_TABLES as follows:

               This string(3,n) tells Perl to consult the CRTL's internal "environ"
               array of key-value pairs, using name as the key.  In most
               cases, this contains only a few keys, but if(3,n) Perl was invoked
               via the C "exec(3,n,1 builtins)[lv]e()" function, as is the case for CGI pro-
               cessing by some HTTP servers, then the "environ" array may have
               been populated by the calling program.

               A string(3,n) beginning with "CLISYM_"tells Perl to consult the
               CLI's symbol tables, using name as the name of the symbol.
               When reading an element of %ENV, the local symbol table is
               scanned first, followed by the global symbol table..  The char-
               acters following "CLISYM_" are significant when an element of
               %ENV is set(7,n,1 builtins) or deleted: if(3,n) the complete string(3,n) is
               "CLISYM_LOCAL", the change is made in(1,8) the local symbol table;
               otherwise the global symbol table is changed.

           Any other string(3,n)
               If an element of PERL_ENV_TABLES translates to any other
               string(3,n), that string(3,n) is used as the name of a logical name ta-
               ble, which is consulted using name as the logical name.  The
               normal search order of access(2,5) modes is used.

           PERL_ENV_TABLES is translated once when Perl starts up; any changes
           you make while Perl is running do not affect the behavior of %ENV.
           If PERL_ENV_TABLES is not defined, then Perl defaults to consulting
           first the logical name tables specified by LNM$FILE_DEV, and then
           the CRTL "environ" array.

           In all operations on %ENV, the key string(3,n) is treated as if(3,n) it were
           entirely uppercase, regardless of the case actually specified in(1,8)
           the Perl expression.

           When an element of %ENV is read(2,n,1 builtins), the locations to which
           PERL_ENV_TABLES points are checked in(1,8) order, and the value obtained
           from the first successful lookup is returned.  If the name of the
           %ENV element contains a semi-colon, it and any characters after it
           are removed.  These are ignored when the CRTL "environ" array or a
           CLI symbol table is consulted.  However, the name is looked up in(1,8) a
           logical name table, the suffix after the semi-colon is treated as
           the translation index to be used for the lookup.   This lets you
           look(1,8,3 Search::Dict) up successive values for search list logical names.  For
           instance, if(3,n) you say

              $  Define STORY  once,upon,a,time(1,2,n),there,was
              $  perl -e "for ($i = 0; $i <= 6; $i++) " -
              _$ -e "{ print $ENV{'story;'.$i},' '}"

           Perl will print "ONCE UPON A TIME THERE WAS", assuming, of course,
           that PERL_ENV_TABLES is set(7,n,1 builtins) up so that the logical name "story" is
           found, rather than a CLI symbol or CRTL "environ" element with the
           same name.

           When an element of %ENV is set(7,n,1 builtins) to a defined string(3,n), the correspond-
           ing definition is made in(1,8) the location to which the first transla-
           tion of PERL_ENV_TABLES points.  If this causes a logical name to
           be created, it is defined in(1,8) supervisor mode.  (The same is done if(3,n)
           an existing logical name was defined in(1,8) executive or kernel mode;
           an existing user or supervisor mode logical name is reset(1,7,1 tput) to the
           new value.)  If the value is an empty string(3,n), the logical name's
           translation is defined as a single NUL (ASCII 00) character, since
           a logical name cannot translate to a zero-length string.  (This
           restriction does not apply to CLI symbols or CRTL "environ" values;
           they are set(7,n,1 builtins) to the empty string.)  An element of the CRTL "envi-
           ron" array can be set(7,n,1 builtins) only if(3,n) your copy of Perl knows about the
           CRTL's "setenv()" function.  (This is present only in(1,8) some versions
           of the DECCRTL; check $Config{d_setenv} to see whether your copy of
           Perl was built with a CRTL that has this function.)

           When an element of %ENV is set(7,n,1 builtins) to "undef", the element is looked up
           as if(3,n) it were being read(2,n,1 builtins), and if(3,n) it is found, it is deleted.  (An
           item "deleted" from the CRTL "environ" array is set(7,n,1 builtins) to the empty
           string(3,n); this can only be done if(3,n) your copy of Perl knows about the
           CRTL "setenv()" function.)  Using "delete" to remove an element
           from %ENV has a similar effect, but after the element is deleted,
           another attempt is made to look(1,8,3 Search::Dict) up the element, so an inner-mode
           logical name or a name in(1,8) another location will replace the logical
           name just deleted.  In either case, only the first value found
           searching PERL_ENV_TABLES is altered.  It is not possible at
           present to define a search list logical name via %ENV.

           The element $ENV{DEFAULT} is special: when read(2,n,1 builtins), it returns Perl's
           current default device and directory, and when set(7,n,1 builtins), it resets them,
           regardless of the definition of PERL_ENV_TABLES.  It cannot be
           cleared or deleted; attempts to do so are silently ignored.

           Note that if(3,n) you want to pass on any elements of the C-local envi-
           ron array to a subprocess which isn't started by fork/exec(3,n,1 builtins), or
           isn't running a C program, you can "promote" them to logical names
           in(1,8) the current process, which will then be inherited by all subpro-
           cesses, by saying

               foreach my $key (qw[C-local keys you want promoted]) {
                   my $temp = $ENV{$key}; # read(2,n,1 builtins) from C-local array
                   $ENV{$key} = $temp;    # and define as logical name

           (You can't just say $ENV{$key} = $ENV{$key}, since the Perl opti-
           mizer is smart enough to elide the expression.)

           Don't try to clear(1,3x,3x clrtobot) %ENV by saying "%ENV = ();", it will throw a
           fatal error.  This is equivalent to doing the following from DCL:

               DELETE/LOGICAL *

           You can imagine how bad things would be if(3,n), for example, the
           SYS$MANAGER or SYS$SYSTEM logicals were deleted.

           At present, the first time(1,2,n) you iterate over %ENV using "keys", or
           "values",  you will incur a time(1,2,n) penalty as all logical names are
           read(2,n,1 builtins), in(1,8) order to fully populate %ENV.  Subsequent iterations will
           not reread logical names, so they won't be as slow, but they also
           won't reflect any changes to logical name tables caused by other

           You do need to be careful with the logicals representing process-
           permanent files, such as "SYS$INPUT" and "SYS$OUTPUT".  The trans-
           lations for these logicals are prepended with a two-byte binary
           value (0x1B 0x00) that needs to be stripped off if(3,n) you want to use
           it. (In previous versions of Perl it wasn't possible to get the
           values of these logicals, as the null byte acted as an end-of-
           string(3,n) marker)

       $!  The string(3,n) value of $! is that returned by the CRTL's strerror()
           function, so it will include the VMS message for VMS-specific
           errors.  The numeric value of $! is the value of "errno", except if(3,n)
           errno is EVMSERR, in(1,8) which case $! contains the value of
           vaxc$errno.  Setting $!  always sets errno to the value specified.
           If this value is EVMSERR, it also sets vaxc$errno to 4 (NO-
           NAME-F-NOMSG), so that the string(3,n) value of $! won't reflect the VMS
           error(8,n) message from before $! was set.

       $^E This variable provides direct access(2,5) to VMS status values in(1,8)
           vaxc$errno, which are often more specific than the generic Unix-
           style error(8,n) messages in(1,8) $!.  Its numeric value is the value of
           vaxc$errno, and its string(3,n) value is the corresponding VMS message
           string(3,n), as retrieved by sys$getmsg().  Setting $^E sets vaxc$errno
           to the value specified.

       $?  The "status value" returned in(1,8) $? is synthesized from the actual
           exit(3,n,1 builtins) status of the subprocess in(1,8) a way that approximates POSIX
           wait(5) semantics, in(1,8) order to allow Perl programs to portably test
           for successful completion of subprocesses.  The low order 8 bits of
           $? are always 0 under VMS, since the termination status of a
           process may or may not have been generated by an exception.  The
           next 8 bits are derived from the severity portion of the subpro-
           cess' exit(3,n,1 builtins) status: if(3,n) the severity was success or informational,
           these bits are all 0; if(3,n) the severity was warning, they contain a
           value of 1; if(3,n) the severity was error(8,n) or fatal error(8,n), they contain
           the actual severity bits, which turns out to be a value of 2 for
           error(8,n) and 4 for fatal error.

           As a result, $? will always be zero if(3,n) the subprocess' exit(3,n,1 builtins) status
           indicated successful completion, and non-zero if(3,n) a warning or error(8,n)
           occurred.  Conversely, when setting $? in(1,8) an END block, an attempt
           is made to convert the POSIX value into a native status intelligi-
           ble to the operating system upon exiting Perl.  What this boils
           down to is that setting $?  to zero results in(1,8) the generic success
           value SS$_NORMAL, and setting $? to a non-zero value results in(1,8) the
           generic failure status SS$_ABORT.  See also "exit(3,n,1 builtins)" in(1,8) perlport.

           The pragma "use vmsish 'status'" makes $? reflect the actual VMS
           exit(3,n,1 builtins) status instead of the default emulation of POSIX status
           described above.  This pragma also disables the conversion of non-
           zero values to SS$_ABORT when setting $? in(1,8) an END block (but zero
           will still be converted to SS$_NORMAL).

       $|  Setting $| for an I/O stream causes data to be flushed all the way
           to disk on each write(1,2) (i.e. not just to the underlying RMS buffers
           for a file(1,n)).  In other words, it's equivalent to calling fflush()
           and fsync() from C.

Standard modules with VMS-specific differences

       SDBM_File works properly on VMS. It has, however, one minor difference.
       The database directory file(1,n) created has a .sdbm_dir extension rather
       than a .dir extension. .dir files are VMS filesystem directory files,
       and using them for other purposes could cause unacceptable problems.

Revision date
       This document was last updated on 01-May-2002, for Perl 5, patchlevel

       Charles Bailey Craig Berry  craig- Dan Sugalski

perl v5.8.5                       2004-04-23                        PERLVMS(1)

References for this manual (incoming links)