source: trunk/essentials/dev-lang/perl/vms/ext/Filespec.pm@ 3186

Last change on this file since 3186 was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 11.0 KB
Line 
1# Perl hooks into the routines in vms.c for interconversion
2# of VMS and Unix file specification syntax.
3#
4# Version: see $VERSION below
5# Author: Charles Bailey [email protected]
6# Revised: 08-Mar-1995
7
8=head1 NAME
9
10VMS::Filespec - convert between VMS and Unix file specification syntax
11
12=head1 SYNOPSIS
13
14use VMS::Filespec;
15$fullspec = rmsexpand('[.VMS]file.specification'[, 'default:[file.spec]']);
16$vmsspec = vmsify('/my/Unix/file/specification');
17$unixspec = unixify('my:[VMS]file.specification');
18$path = pathify('my:[VMS.or.Unix.directory]specification.dir');
19$dirfile = fileify('my:[VMS.or.Unix.directory.specification]');
20$vmsdir = vmspath('my/VMS/or/Unix/directory/specification.dir');
21$unixdir = unixpath('my:[VMS.or.Unix.directory]specification.dir');
22candelete('my:[VMS.or.Unix]file.specification');
23
24=head1 DESCRIPTION
25
26This package provides routines to simplify conversion between VMS and
27Unix syntax when processing file specifications. This is useful when
28porting scripts designed to run under either OS, and also allows you
29to take advantage of conveniences provided by either syntax (I<e.g.>
30ability to easily concatenate Unix-style specifications). In
31addition, it provides an additional file test routine, C<candelete>,
32which determines whether you have delete access to a file.
33
34If you're running under VMS, the routines in this package are special,
35in that they're automatically made available to any Perl script,
36whether you're running F<miniperl> or the full F<perl>. The C<use
37VMS::Filespec> or C<require VMS::Filespec; import VMS::Filespec ...>
38statement can be used to import the function names into the current
39package, but they're always available if you use the fully qualified
40name, whether or not you've mentioned the F<.pm> file in your script.
41If you're running under another OS and have installed this package, it
42behaves like a normal Perl extension (in fact, you're using Perl
43substitutes to emulate the necessary VMS system calls).
44
45Each of these routines accepts a file specification in either VMS or
46Unix syntax, and returns the converted file specification, or C<undef>
47if an error occurs. The conversions are, for the most part, simply
48string manipulations; the routines do not check the details of syntax
49(e.g. that only legal characters are used). There is one exception:
50when running under VMS, conversions from VMS syntax use the $PARSE
51service to expand specifications, so illegal syntax, or a relative
52directory specification which extends above the tope of the current
53directory path (e.g [---.foo] when in dev:[dir.sub]) will cause
54errors. In general, any legal file specification will be converted
55properly, but garbage input tends to produce garbage output.
56
57Each of these routines is prototyped as taking a single scalar
58argument, so you can use them as unary operators in complex
59expressions (as long as you don't use the C<&> form of
60subroutine call, which bypasses prototype checking).
61
62
63The routines provided are:
64
65=head2 rmsexpand
66
67Uses the RMS $PARSE and $SEARCH services to expand the input
68specification to its fully qualified form, except that a null type
69or version is not added unless it was present in either the original
70file specification or the default specification passed to C<rmsexpand>.
71(If the file does not exist, the input specification is expanded as much