Mass Deface
will return C<[...]>.
The handling of extended characters is largely complete in the
VMS-specific C infrastructure of Perl, but more work is still needed to
fully support extended syntax filenames in several core modules. In
particular, at this writing PathTools has only partial support for
directories containing some extended characters.
There are several ambiguous cases where a conversion routine cannot
determine whether an input filename is in Unix format or in VMS format,
since now both VMS and Unix file specifications may have characters in
them that could be mistaken for syntax delimiters of the other type. So
some pathnames simply cannot be used in a mode that allows either type
of pathname to be present. Perl will tend to assume that an ambiguous
filename is in Unix format.
Allowing "." as a version delimiter is simply incompatible with
determining whether a pathname is in VMS format or in Unix format with
extended file syntax. There is no way to know whether "perl-5.8.6" is a
Unix "perl-5.8.6" or a VMS "perl-5.8;6" when passing it to unixify() or
vmsify().
The DECC$FILENAME_UNIX_REPORT logical name controls how Perl interprets
filenames to the extent that Perl uses the CRTL internally for many
purposes, and attempts to follow CRTL conventions for reporting
filenames. The DECC$FILENAME_UNIX_ONLY feature differs in that it
expects all filenames passed to the C run-time to be already in Unix
format. This feature is not yet supported in Perl since Perl uses
traditional OpenVMS file specifications internally and in the test
harness, and it is not yet clear whether this mode will be useful or
useable. The feature logical name DECC$POSIX_COMPLIANT_PATHNAMES is new
with the RMS Symbolic Link SDK and included with OpenVMS v8.3, but is
not yet supported in Perl.
=head2 Filename Case
Perl follows VMS defaults and override settings in preserving (or not
preserving) filename case. Case is not preserved on ODS-2 formatted
volumes on any architecture. On ODS-5 volumes, filenames may be case
preserved depending on process and feature settings. Perl now honors
DECC$EFS_CASE_PRESERVE and DECC$ARGV_PARSE_STYLE on those systems where
the CRTL supports these features. When these features are not enabled
or the CRTL does not support them, Perl follows the traditional CRTL
behavior of downcasing command-line arguments and returning file
specifications in lower case only.
I It is very easy to get tripped up using a mixture of other
programs, external utilities, and Perl scripts that are in varying
states of being able to handle case preservation. For example, a file
created by an older version of an archive utility or a build utility
such as MMK or MMS may generate a filename in all upper case even on an
ODS-5 volume. If this filename is later retrieved by a Perl script or
module in a case preserving environment, that upper case name may not
match the mixed-case or lower-case exceptions of the Perl code. Your
best bet is to follow an all-or-nothing approach to case preservation:
either don't use it at all, or make sure your entire toolchain and
application environment support and use it.
OpenVMS Alpha v7.3-1 and later and all version of OpenVMS I64 support
case sensitivity as a process setting (see C). Perl does not currently support case
sensitivity on VMS, but it may in the future, so Perl programs should
use the C<< File::Spec->case_tolerant >> method to determine the state, and
not the C<$^O> variable.
=head2 Symbolic Links
When built on an ODS-5 volume with symbolic links enabled, Perl by
default supports symbolic links when the requisite support is available
in the filesystem and CRTL (generally 64-bit OpenVMS v8.3 and later).
There are a number of limitations and caveats to be aware of when
working with symbolic links on VMS. Most notably, the target of a valid
symbolic link must be expressed as a Unix-style path and it must exist
on a volume visible from your POSIX root (see the C command
in DCL help). For further details on symbolic link capabilities and
requirements, see chapter 12 of the CRTL manual that ships with OpenVMS
v8.3 or later.
=head2 Wildcard expansion
File specifications containing wildcards are allowed both on
the command line and within Perl globs (e.g. C*.cE>). If
the wildcard filespec uses VMS syntax, the resultant
filespecs will follow VMS syntax; if a Unix-style filespec is
passed in, 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 C<"> around a perl program command line argument. However,
owing to the stripping of C<"> characters carried out by the C
handling of argv you will need to escape a construct such as
this one (in a directory containing the files F, F,
F, and F):
$ perl -e "print join(' ',@ARGV)" perl.*
perl.c perl.exe perl.h perl.obj
in the following triple quoted manner:
$ perl -e "print join(' ',@ARGV)" """perl.*"""
perl.*
In both the case of unquoted command line arguments or in calls
to C VMS wildcard expansion is performed. (csh-style
wildcard expansion is available if you use C.)
If the wildcard filespec contains a device or directory
specification, then the resultant 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 the input filespec. For example, if
your default directory is Perl_Root:[000000], the expansion
of C<[.t]*.*> will yield filespecs like
"perl_root:[t]base.dir", while the expansion of C will
yield filespecs like "t/base.dir". (This is done to match
the behavior of glob expansion performed by Unix shells.)
Similarly, the resultant filespec will contain the file version
only if one was present in the input filespec.
=head2 Pipes
Input and output pipes to Perl filehandles are supported; the
"file name" is passed to lib$spawn() for asynchronous
execution. You should be careful to close any pipes you have
opened in 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 between the backticks is handled as if it were the
argument to the C operator (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
defaults to a buffer size of 8192 on 64-bit systems, 512 on VAX. 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 example, to set the mailbox size to 32767 use
C<$ENV{'PERL_MBX_SIZE'} = 32767;> and then open and use pipe constructs.
An alternative would be to issue the command:
$ Define PERL_MBX_SIZE 32767
before running your wide record pipe program. A larger value may
improve performance at the expense of the BYTLM UAF quota.
=head1 PERL5LIB and PERLLIB
The PERL5LIB and PERLLIB logical names work as documented in L,
except that the element separator is '|' instead of ':'. The
directory specifications may use either VMS or Unix syntax.
=head1 The Perl Forked Debugger
The Perl forked debugger places the debugger commands and output in a
separate X-11 terminal window so that commands and output from multiple
processes are not mixed together.
Perl on VMS supports an emulation of the forked debugger when Perl is
run on a VMS system that has X11 support installed.
To use the forked debugger, you need to have the default display set to an
X-11 Server and some environment variables set that Unix expects.
The forked debugger requires the environment variable C to be C,
and the environment variable C to exist. C must be in
lower case.
$define TERM "xterm"
$define DISPLAY "hostname:0.0"
Currently the value of C is ignored. It is recommended that it be set
to be the hostname of the display, the server and screen in Unix notation. In
the future the value of DISPLAY may be honored by Perl instead of using the
default display.
It may be helpful to always use the forked debugger so that script I/O is
separated from debugger I/O. You can force the debugger to be forked by
assigning a value to the logical name that is not a process
identification number.
$define PERLDB_PIDS XXXX
=head1 PERL_VMS_EXCEPTION_DEBUG
The PERL_VMS_EXCEPTION_DEBUG being defined as "ENABLE" will cause the VMS
debugger to be invoked if a fatal exception that is not otherwise
handled is raised. The purpose of this is to allow debugging of
internal Perl problems that would cause such a condition.
This allows the programmer to look at the execution stack and variables to
find out the cause of the exception. As the debugger is being invoked as
the Perl interpreter is about to do a fatal exit, continuing the execution
in debug mode is usually not practical.
Starting Perl in the VMS debugger may change the program execution
profile in a way that such problems are not reproduced.
The C function can be used to test this functionality from within
a program.
In typical VMS style, only the first letter of the value of this logical
name is actually checked in a case insensitive mode, and it is considered
enabled if it is the value "T","1" or "E".
This logical name must be defined before Perl is started.
=head1 Command line
=head2 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:
=over 4
=item *
Cfile> reads stdin from C,
=item *
Cfile> writes stdout to C,
=item *
CEfile> appends stdout to C,
=item *
C<2Efile> writes stderr to C,
=item *
C<2EEfile> appends stderr to C, and
=item *
C<< 2>&1 >> redirects stderr to stdout.
=back
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 the command line ends with '&', the entire
command is run in the background as an asynchronous
subprocess.
=head2 Command line switches
The following command line switches behave differently under
VMS than described in L. Note also that in order
to pass uppercase switches to Perl, you need to enclose
them in double-quotes on the command line, since the CRTL
downcases all unquoted strings.
On newer 64 bit versions of OpenVMS, a process setting now
controls if the quoting is needed to preserve the case of
command line arguments.
=over 4
=item -i
If the C<-i> switch is present but no extension for a backup
copy is given, then inplace editing creates a new version of
a file; the existing copy is not deleted. (Note that if
an extension is given, an existing file is renamed to the backup
file, as is the case under other operating systems, so it does
not remain as a previous version under the original filename.)
=item -S
If the C<"-S"> or C<-"S"> switch is present I 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 which to look for the script. In addition,
if no file type is specified, Perl looks in each directory
for a file matching the name specified, with a blank type,
a type of F<.pl>, and a type of F<.com>, in that order.
=item -u
The C<-u> switch causes the VMS debugger to be invoked
after the Perl program is compiled, but before it has
run. It does not create a core dump file.
=back
=head1 Perl functions
As of the time this document was last revised, the following
Perl functions were implemented in the VMS port of Perl
(functions marked with * are discussed in more detail below):
file tests*, abs, alarm, atan, backticks*, binmode*, bless,
caller, chdir, chmod, chown, chomp, chop, chr,
close, closedir, cos, crypt*, defined, delete, die, do, dump*,
each, endgrent, endpwent, eof, eval, exec*, exists, exit, exp,
fileno, flock getc, getgrent*, getgrgid*, getgrnam, getlogin, getppid,
getpwent*, getpwnam*, getpwuid*, glob, gmtime*, goto,
grep, hex, ioctl, import, index, int, join, keys, kill*,
last, lc, lcfirst, lchown*, length, link*, local, localtime, log, lstat, m//,
map, mkdir, my, next, no, oct, open, opendir, ord, pack,
pipe, pop, pos, print, printf, push, q//, qq//, qw//,
qx//*, quotemeta, rand, read, readdir, readlink*, redo, ref, rename,
require, reset, return, reverse, rewinddir, rindex,
rmdir, s///, scalar, seek, seekdir, select(internal),
select (system call)*, setgrent, setpwent, shift, sin, sleep,
socketpair, sort, splice, split, sprintf, sqrt, srand, stat,
study, substr, symlink*, sysread, system*, syswrite, tell,
telldir, tie, time, times*, tr///, uc, ucfirst, umask,
undef, unlink*, unpack, untie, unshift, use, utime*,
values, vec, wait, waitpid*, wantarray, warn, write, y///
The following functions were not implemented in the VMS port,
and calling them produces a fatal error (usually) or
undefined behavior (rarely, we hope):
chroot, dbmclose, dbmopen, fork*, getpgrp, getpriority,
msgctl, msgget, msgsend, msgrcv, semctl,
semget, semop, setpgrp, setpriority, shmctl, shmget,
shmread, shmwrite, syscall
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:
accept, bind, connect, getpeername,
gethostbyname, getnetbyname, getprotobyname,
getservbyname, gethostbyaddr, getnetbyaddr,
getprotobynumber, getservbyport, gethostent,
getnetent, getprotoent, getservent, sethostent,
setnetent, setprotoent, setservent, endhostent,
endnetent, endprotoent, endservent, getsockname,
getsockopt, listen, recv, select(system call)*,
send, setsockopt, shutdown, socket
The following function is available on Perls built on 64 bit OpenVMS v8.2
with hard links enabled on an ODS-5 formatted build disk. CRTL support
is in principle available as of OpenVMS v7.3-1, and better configuration
support could detect this.
link
The following functions are available on Perls built on 64 bit OpenVMS
v8.2 and later. CRTL support is in principle available as of OpenVMS
v7.3-2, and better configuration support could detect this.
getgrgid, getgrnam, getpwnam, getpwuid,
setgrent, ttyname
The following functions are available on Perls built on 64 bit OpenVMS v8.2
and later.
statvfs, socketpair
=over 4
=item File tests
The tests C<-b>, C<-B>, C<-c>, C<-C>, C<-d>, C<-e>, C<-f>,
C<-o>, C<-M>, C<-s>, C<-S>, C<-t>, C<-T>, and C<-z> work as
advertised. The return values for C<-r>, C<-w>, and C<-x>
tell you whether you can actually access the file; this may
not reflect the UIC-based file protections. Since real and
effective UIC don't differ under VMS, C<-O>, C<-R>, C<-W>,
and C<-X> are equivalent to C<-o>, C<-r>, C<-w>, and C<-x>.
Similarly, several other tests, including C<-A>, C<-g>, C<-k>,
C<-l>, C<-p>, and C<-u>, aren't particularly meaningful under
VMS, and the values returned by these tests reflect whatever
your CRTL C routine does to the equivalent bits in the
st_mode field. Finally, C<-d> returns true if passed a device
specification without an explicit directory (e.g. C), as
well as if passed a directory.
There are DECC feature logical names AND ODS-5 volume attributes that
also control what values are returned for the date fields.
Note: Some sites have reported problems when using the file-access
tests (C<-r>, C<-w>, and C<-x>) on files accessed via DEC's DFS.
Specifically, since DFS does not currently provide access to the
extended file header of files on remote volumes, attempts to
examine the ACL fail, and the file tests will return false,
with C<$!> indicating that the file does not exist. You can
use C on these files, since that checks UIC-based protection
only, and then manually check the appropriate bits, as defined by
your C compiler's F, in the mode value it returns, if you
need an approximation of the file's protections.
=item backticks
Backticks create a subprocess, and pass the enclosed string
to it for execution as a DCL command. Since the subprocess is
created directly via C, any valid DCL command string
may be specified.
=item binmode FILEHANDLE
The C operator will attempt to insure that no translation
of carriage control occurs on input from or output to this filehandle.
Since this involves reopening the file and then restoring its
file position indicator, if this function returns FALSE, the
underlying filehandle may no longer point to an open file, or may
point to a different position in the file than before C
was called.
Note that C 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
C function in the VMS::Stdio extension to gain finer
control of I/O to files and devices with different record structures.
=item crypt PLAINTEXT, USER
The C operator uses the C 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 C may be compared against
the encrypted password from the UAF returned by the C
functions, in order to authenticate users. If you're
going to do this, remember that the encrypted password in
the UAF was generated using uppercase username and
password strings; you'll have to upcase the arguments to
C to insure that you'll get the proper value:
sub validate_passwd {
my($user,$passwd) = @_;
my($pwdhash);
if ( !($pwdhash = (getpwnam($user))[1]) ||
$pwdhash ne crypt("\U$passwd","\U$name") ) {
intruder_alert($name);
}
return 1;
}
=item die
C will force the native VMS exit status to be an SS$_ABORT code
if neither of the $! or $? status values are ones that would cause
the native status to be interpreted as being what VMS classifies as
SEVERE_ERROR severity for DCL error handling.
When C is active (see L"$?"> below), the native VMS exit
status value will have either one of the C<$!> or C<$?> or C<$^E> or
the Unix value 255 encoded into it in a way that the effective original
value can be decoded by other programs written in C, including Perl
and the GNV package. As per the normal non-VMS behavior of C if
either C<$!> or C<$?> are non-zero, one of those values will be
encoded into a native VMS status value. If both of the Unix status
values are 0, and the C<$^E> value is set one of ERROR or SEVERE_ERROR
severity, then the C<$^E> value will be used as the exit code as is.
If none of the above apply, the Unix value of 255 will be encoded into
a native VMS exit status value.
Please note a significant difference in the behavior of C in
the C mode is that it does not force a VMS
SEVERE_ERROR status on exit. The Unix exit values of 2 through
255 will be encoded in VMS status values with severity levels of
SUCCESS. The Unix exit value of 1 will be encoded in a VMS status
value with a severity level of ERROR. This is to be compatible with
how the VMS C library encodes these values.
The minimum severity level set by C in C mode
may be changed to be ERROR or higher in the future depending on the
results of testing and further review.
See L"$?"> for a description of the encoding of the Unix value to
produce a native VMS status containing it.
=item dump
Rather than causing Perl to abort and dump core, the C
operator 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
C, or, if no label was specified, back to the
beginning of the program. All other state of the program
(I values of variables, open file handles) are not
affected by calling C.
=item exec LIST
A call to C will cause Perl to exit, and to invoke the command
given as an argument to C via C. If the
argument 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 F<.Exe> and the process
defaults to expand the filespec) and pass the rest of C's
argument to it as parameters. If the token has no file type, and
matches a file with null type, then an attempt is made to determine
whether the file is an executable image which should be invoked
using C or a text file which should be passed to DCL as a
command procedure.
=item fork
While in principle the C operator could be implemented via
(and with the same rather severe limitations as) the CRTL C
routine, and while some internal support to do just that is in
place, the implementation has never been completed, making C
currently unavailable. A true kernel C is expected in a
future version of VMS, and the pseudo-fork based on interpreter
threads may be available in a future version of Perl on VMS (see
L). In the meantime, use C, backticks, or piped
filehandles to create subprocesses.
=item getpwent
=item getpwnam
=item getpwuid
These operators obtain the information described in L,
if you have the privileges necessary to retrieve the named user's
UAF information via C. If not, then only the C<$name>,
C<$uid>, and C<$gid> items are returned. The C<$dir> item contains
the login directory in VMS syntax, while the C<$comment> item
contains the login directory in Unix syntax. The C<$gcos> item
contains the owner field from the UAF record. The C<$quota>
item is not used.
=item gmtime
The C operator will function properly if you have a
working CRTL C routine, or if the logical name
SYS$TIMEZONE_DIFFERENTIAL is defined as the number of seconds
which must be added to UTC to yield local time. (This logical
name is defined automatically if you are running a version of
VMS with built-in UTC support.) If neither of these cases is
true, a warning message is printed, and C is returned.
=item kill
In most cases, C is implemented via the undocumented system
service C<$SIGPRC>, which has the same calling sequence as C<$FORCEX>, but
throws an exception in the target process rather than forcing it to call
C<$EXIT>. Generally speaking, C follows the behavior of the
CRTL's C function, but unlike that function can be called from
within a signal handler. Also, unlike the C in some versions of
the CRTL, Perl's C checks the validity of the signal passed in and
returns an error rather than attempting to send an unrecognized signal.
Also, negative signal values don't do anything special under
VMS; they're just converted to the corresponding positive value.
=item qx//
See the entry on C above.
=item select (system call)
If Perl was not built with socket support, the system call
version of C