We hope these notes will save you from confusion and lost
sleep 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 vmsperl@newman.upenn.edu.
+hesitate to drop a line to vmsperl@perl.org.
=head1 Installation
and calling them produces a fatal error (usually) or
undefined behavior (rarely, we hope):
- chroot, dbmclose, dbmopen, fcntl, flock,
+ chroot, dbmclose, dbmopen, flock,
getpgrp, getppid, getpriority, getgrent, getgrgid,
getgrnam, setgrent, endgrent, ioctl, link, lstat,
msgctl, msgget, msgsend, msgrcv, readlink, 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 compiled with Dec C
+5.2 or greater and running VMS 7.0 or greater:
truncate
+The following functions are available on Perls built on VMS 7.2 or
+greater:
+
+ fcntl (without locking)
+
The following functions may or may not be implemented,
depending on what type of socket support you've built into
your copy of Perl:
the subprocess before calling C<exec>.
In general, the use of C<fork> and C<exec> to create
-subprocess is not recommended under VMS; wherever possible,
+subprocesses is not recommended under VMS; wherever possible,
use the C<system> operator or piped filehandles instead.
=item getpwent
Perl waits for the subprocess to complete before continuing
execution in the current process. As described in L<perlfunc>,
the return value of C<system> is a fake "status" which follows
-POSIX semantics; see the description of C<$?> in this document
-for more detail. The actual VMS exit status of the subprocess
-is available in C<$^S> (as long as you haven't used another Perl
-function that resets C<$?> and C<$^S> in the meantime).
+POSIX semantics unless the pragma C<use vmsish 'status'> is in
+effect; see the description of C<$?> in this document for more
+detail.
=item time
C<unlink> will delete the highest version of a file only; in
order to delete all versions, you need to say
- 1 while (unlink LIST);
+ 1 while unlink LIST;
You may need to make this change to scripts written for a
Unix system which expect that after a call to C<unlink>,
If PID is a subprocess started by a piped C<open()> (see L<open>),
C<waitpid> will wait for that subprocess, and return its final
-status value. If PID is a subprocess created in some other way
-(e.g. SPAWNed before Perl was invoked), or is not a subprocess of
-the current process, C<waitpid> will check once per second whether
-the process has completed, and when it has, will return 0. (If PID
-specifies a process that isn't a subprocess of the current process,
-and you invoked Perl with the C<-w> switch, a warning will be issued.)
-
-The FLAGS argument is ignored in all cases.
+status value in C<$?>. If PID is a subprocess created in some other
+way (e.g. SPAWNed before Perl was invoked), or is not a subprocess
+of the current process, C<waitpid> will attempt to read from the
+process's termination mailbox, making the final status available in
+C<$?> when the process completes. If the process specified by PID
+has no termination mailbox, C<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 C<-w> switch, a warning will
+be issued.)
+
+Returns PID on success, -1 on error. The FLAGS argument is ignored
+in all cases.
=back
(You can't just say C<$ENV{$key} = $ENV{$key}>, since the
Perl optimizer is smart enough to elide the expression.)
+Don't try to clear C<%ENV> by saying C<%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, for example, the SYS$MANAGER
+or SYS$SYSTEM logicals were deleted.
+
At present, the first time you iterate over %ENV using
C<keys>, or C<values>, you will incur a time penalty as all
logical names are read, in order to fully populate %ENV.
generated by an exception. The next 8 bits are derived from
the severity portion of the subprocess' exit status: if the
severity was success or informational, these bits are all 0;
-otherwise, they contain the severity value shifted left one bit.
+if the severity was warning, they contain a value of 1; if the
+severity was error or fatal error, they contain the actual
+severity bits, which turns out to be a value of 2 for error
+and 4 for fatal error.
+
As a result, C<$?> will always be zero if the subprocess' exit
status indicated successful completion, and non-zero if a
-warning or error occurred. The actual VMS exit status may
-be found in C<$^S> (q.v.).
-
-=item $^S
-
-Under VMS, this is the 32-bit VMS status value returned by the
-last subprocess to complete. Unlike C<$?>, no manipulation
-is done to make this look like a POSIX wait(5) value, so it
-may be treated as a normal VMS status value.
+warning or error occurred. Conversely, when setting C<$?> in
+an END block, an attempt is made to convert the POSIX value
+into a native status intelligible to the operating system upon
+exiting Perl. What this boils down to is that setting C<$?>
+to zero results in the generic success value SS$_NORMAL, and
+setting C<$?> to a non-zero value results in the generic
+failure status SS$_ABORT. See also L<perlport/exit>.
+
+The pragma C<use vmsish 'status'> makes C<$?> reflect the actual
+VMS exit 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 C<$?> in an END
+block (but zero will still be converted to SS$_NORMAL).
=item $|
=head1 Revision date
-This document was last updated on 26-Feb-2000, for Perl 5,
-patchlevel 6.
+This document was last updated on 2-Oct-2001, for Perl 5,
+patchlevel 8.
=head1 AUTHOR
Charles Bailey <bailey@cor.newman.upenn.edu>
+Craig Berry <craigberry@mac.com>
Dan Sugalski <dan@sidhe.org>