$fullspec
=
rmsexpand('[.VMS]file.specification');
$vmsspec
=
vmsify('/my/Unix/file/specification');
$unixspec
= unixify('my:[VMS]file.specification');
$path =
pathify('my:[VMS.or.Unix.directory]specification.dir');
$dirfile
=
fileify('my:[VMS.or.Unix.directory.specification]');
$vmsdir
=
vmspath('my/VMS/or/Unix/directory/specification.dir');
$unixdir
=
unixpath('my:[VMS.or.Unix.directory]specification.dir');
candelete('my:[VMS.or.Unix]file.specification');
candelete
, which determines whether you have delete access to a file.
If you're running under
VMS, the routines in this package are special, in that
they're automatically made available to any Perl script, whether you're
running miniperl or the full perl. The use
VMS::Filespec
or require VMS::Filespec; import VMS::Filespec ...
statement can be used to import the function names into the current
package, but they're always available if you use the fully qualified name,
whether or not you've mentioned the .pm file in your script. If you're running under another
OS and have installed this package, it behaves like a normal Perl extension (in fact, you're using Perl substitutes to emulate the necessary
VMS system calls).
Each of these routines accepts a file specification in either
VMS or Unix syntax, and returns the converted file
specification, or undef
if an error occurs. The conversions are, for the most part, simply string manipulations; the routines do not check the details of syntax (e.g. that only legal characters are used). There is one exception: when running under
VMS, conversions from
VMS syntax use the $PARSE
service to expand specifications, so illegal syntax, or a relative directory specification which extends above the tope of the current directory path (e.g [---.foo] when in dev:[dir.sub]) will cause errors. In general, any legal file specification will be converted properly, but garbage input tends to produce garbage output.
Each of these routines is prototyped as taking a single scalar argument, so
you can use them as unary operators in complex expressions (as long as you
don't use the &
form of subroutine call, which bypasses prototype checking).
The routines provided are:
$PARSE
and $SEARCH
services to expand the input specification to its fully qualified form. (If
the file does not exist, the input specification is expanded as much as
possible.) If an error occurs, returns undef and sets $!
and $^E
.
pathify
, the input file specification must have a type and version of .DIR;1, or the type and version must be omitted.
pathify
, but insures the returned path uses
VMS syntax.
pathify
, but insures the returned path uses Unix syntax.
candelete
returns true. If you don't, or its argument isn't a legal file
specification,
candelete
returns
FALSE. Unlike other file tests, the argument to
candelete
must be a file name (not a FileHandle), and, since it's an
XSUB, it's a list operator, so you need to be careful
about parentheses. Both of these restrictions may be removed in the future
if the functionality of
candelete
becomes part of the Perl core.