Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / File::Spec.3
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "File::Spec 3"
132.TH File::Spec 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide"
133.SH "NAME"
134File::Spec \- portably perform operations on file names
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.Vb 1
138\& use File::Spec;
139.Ve
140.PP
141.Vb 1
142\& $x=File::Spec->catfile('a', 'b', 'c');
143.Ve
144.PP
145which returns 'a/b/c' under Unix. Or:
146.PP
147.Vb 1
148\& use File::Spec::Functions;
149.Ve
150.PP
151.Vb 1
152\& $x = catfile('a', 'b', 'c');
153.Ve
154.SH "DESCRIPTION"
155.IX Header "DESCRIPTION"
156This module is designed to support operations commonly performed on file
157specifications (usually called \*(L"file names\*(R", but not to be confused with the
158contents of a file, or Perl's file handles), such as concatenating several
159directory and file names into a single path, or determining whether a path
160is rooted. It is based on code directly taken from MakeMaker 5.17, code
161written by Andreas Ko\*:nig, Andy Dougherty, Charles Bailey, Ilya
162Zakharevich, Paul Schinder, and others.
163.PP
164Since these functions are different for most operating systems, each set of
165\&\s-1OS\s0 specific routines is available in a separate module, including:
166.PP
167.Vb 5
168\& File::Spec::Unix
169\& File::Spec::Mac
170\& File::Spec::OS2
171\& File::Spec::Win32
172\& File::Spec::VMS
173.Ve
174.PP
175The module appropriate for the current \s-1OS\s0 is automatically loaded by
176File::Spec. Since some modules (like \s-1VMS\s0) make use of facilities available
177only under that \s-1OS\s0, it may not be possible to load all modules under all
178operating systems.
179.PP
180Since File::Spec is object oriented, subroutines should not be called directly,
181as in:
182.PP
183.Vb 1
184\& File::Spec::catfile('a','b');
185.Ve
186.PP
187but rather as class methods:
188.PP
189.Vb 1
190\& File::Spec->catfile('a','b');
191.Ve
192.PP
193For simple uses, File::Spec::Functions provides convenient functional
194forms of these methods.
195.SH "METHODS"
196.IX Header "METHODS"
197.IP "canonpath" 2
198.IX Item "canonpath"
199No physical check on the filesystem, but a logical cleanup of a
200path.
201.Sp
202.Vb 1
203\& $cpath = File::Spec->canonpath( $path ) ;
204.Ve
205.IP "catdir" 2
206.IX Item "catdir"
207Concatenate two or more directory names to form a complete path ending
208with a directory. But remove the trailing slash from the resulting
209string, because it doesn't look good, isn't necessary and confuses
210\&\s-1OS2\s0. Of course, if this is the root directory, don't cut off the
211trailing slash :\-)
212.Sp
213.Vb 1
214\& $path = File::Spec->catdir( @directories );
215.Ve
216.IP "catfile" 2
217.IX Item "catfile"
218Concatenate one or more directory names and a filename to form a
219complete path ending with a filename
220.Sp
221.Vb 1
222\& $path = File::Spec->catfile( @directories, $filename );
223.Ve
224.IP "curdir" 2
225.IX Item "curdir"
226Returns a string representation of the current directory.
227.Sp
228.Vb 1
229\& $curdir = File::Spec->curdir();
230.Ve
231.IP "devnull" 2
232.IX Item "devnull"
233Returns a string representation of the null device.
234.Sp
235.Vb 1
236\& $devnull = File::Spec->devnull();
237.Ve
238.IP "rootdir" 2
239.IX Item "rootdir"
240Returns a string representation of the root directory.
241.Sp
242.Vb 1
243\& $rootdir = File::Spec->rootdir();
244.Ve
245.IP "tmpdir" 2
246.IX Item "tmpdir"
247Returns a string representation of the first writable directory from a
248list of possible temporary directories. Returns "" if no writable
249temporary directories are found. The list of directories checked
250depends on the platform; e.g. File::Spec::Unix checks \f(CW$ENV\fR{\s-1TMPDIR\s0} and
251/tmp.
252.Sp
253.Vb 1
254\& $tmpdir = File::Spec->tmpdir();
255.Ve
256.IP "updir" 2
257.IX Item "updir"
258Returns a string representation of the parent directory.
259.Sp
260.Vb 1
261\& $updir = File::Spec->updir();
262.Ve
263.IP "no_upwards" 2
264.IX Item "no_upwards"
265Given a list of file names, strip out those that refer to a parent
266directory. (Does not strip symlinks, only '.', '..', and equivalents.)
267.Sp
268.Vb 1
269\& @paths = File::Spec->no_upwards( @paths );
270.Ve
271.IP "case_tolerant" 2
272.IX Item "case_tolerant"
273Returns a true or false value indicating, respectively, that alphabetic
274is not or is significant when comparing file specifications.
275.Sp
276.Vb 1
277\& $is_case_tolerant = File::Spec->case_tolerant();
278.Ve
279.IP "file_name_is_absolute" 2
280.IX Item "file_name_is_absolute"
281Takes as argument a path and returns true if it is an absolute path.
282.Sp
283.Vb 1
284\& $is_absolute = File::Spec->file_name_is_absolute( $path );
285.Ve
286.Sp
287This does not consult the local filesystem on Unix, Win32, \s-1OS/2\s0, or
288Mac \s-1OS\s0 (Classic). It does consult the working environment for \s-1VMS\s0
289(see \*(L"file_name_is_absolute\*(R" in File::Spec::VMS).
290.IP "path" 2
291.IX Item "path"
292Takes no argument, returns the environment variable \s-1PATH\s0 as an array.
293.Sp
294.Vb 1
295\& @PATH = File::Spec->path();
296.Ve
297.IP "join" 2
298.IX Item "join"
299join is the same as catfile.
300.IP "splitpath" 2
301.IX Item "splitpath"
302Splits a path in to volume, directory, and filename portions. On systems
303with no concept of volume, returns undef for volume.
304.Sp
305.Vb 2
306\& ($volume,$directories,$file) = File::Spec->splitpath( $path );
307\& ($volume,$directories,$file) = File::Spec->splitpath( $path, $no_file );
308.Ve
309.Sp
310For systems with no syntax differentiating filenames from directories,
311assumes that the last file is a path unless \f(CW$no_file\fR is true or a
312trailing separator or /. or /.. is present. On Unix this means that \f(CW$no_file\fR
313true makes this return ( '', \f(CW$path\fR, '' ).
314.Sp
315The directory portion may or may not be returned with a trailing '/'.
316.Sp
317The results can be passed to \*(L"\fIcatpath()\fR\*(R" to get back a path equivalent to
318(usually identical to) the original path.
319.IP "splitdir" 2
320.IX Item "splitdir"
321The opposite of \*(L"\fIcatdir()\fR\*(R".
322.Sp
323.Vb 1
324\& @dirs = File::Spec->splitdir( $directories );
325.Ve
326.Sp
327$directories must be only the directory portion of the path on systems
328that have the concept of a volume or that have path syntax that differentiates
329files from directories.
330.Sp
331Unlike just splitting the directories on the separator, empty
332directory names (\f(CW''\fR) can be returned, because these are significant
333on some OSs.
334.IP "\fIcatpath()\fR" 2
335.IX Item "catpath()"
336Takes volume, directory and file portions and returns an entire path. Under
337Unix, \f(CW$volume\fR is ignored, and directory and file are catenated. A '/' is
338inserted if need be. On other OSs, \f(CW$volume\fR is significant.
339.Sp
340.Vb 1
341\& $full_path = File::Spec->catpath( $volume, $directory, $file );
342.Ve
343.IP "abs2rel" 2
344.IX Item "abs2rel"
345Takes a destination path and an optional base path returns a relative path
346from the base path to the destination path:
347.Sp
348.Vb 2
349\& $rel_path = File::Spec->abs2rel( $path ) ;
350\& $rel_path = File::Spec->abs2rel( $path, $base ) ;
351.Ve
352.Sp
353If \f(CW$base\fR is not present or '', then \fIcwd()\fR is used. If \f(CW$base\fR is relative,
354then it is converted to absolute form using \*(L"\fIrel2abs()\fR\*(R". This means that it
355is taken to be relative to \fIcwd()\fR.
356.Sp
357On systems with the concept of a volume, this assumes that both paths
358are on the \f(CW$destination\fR volume, and ignores the \f(CW$base\fR volume.
359.Sp
360On systems that have a grammar that indicates filenames, this ignores the
361\&\f(CW$base\fR filename as well. Otherwise all path components are assumed to be
362directories.
363.Sp
364If \f(CW$path\fR is relative, it is converted to absolute form using \*(L"\fIrel2abs()\fR\*(R".
365This means that it is taken to be relative to \fIcwd()\fR.
366.Sp
367No checks against the filesystem are made. On \s-1VMS\s0, there is
368interaction with the working environment, as logicals and
369macros are expanded.
370.Sp
371Based on code written by Shigio Yamaguchi.
372.IP "\fIrel2abs()\fR" 2
373.IX Item "rel2abs()"
374Converts a relative path to an absolute path.
375.Sp
376.Vb 2
377\& $abs_path = File::Spec->rel2abs( $path ) ;
378\& $abs_path = File::Spec->rel2abs( $path, $base ) ;
379.Ve
380.Sp
381If \f(CW$base\fR is not present or '', then \fIcwd()\fR is used. If \f(CW$base\fR is relative,
382then it is converted to absolute form using \*(L"\fIrel2abs()\fR\*(R". This means that it
383is taken to be relative to \fIcwd()\fR.
384.Sp
385On systems with the concept of a volume, this assumes that both paths
386are on the \f(CW$base\fR volume, and ignores the \f(CW$path\fR volume.
387.Sp
388On systems that have a grammar that indicates filenames, this ignores the
389\&\f(CW$base\fR filename as well. Otherwise all path components are assumed to be
390directories.
391.Sp
392If \f(CW$path\fR is absolute, it is cleaned up and returned using \*(L"\fIcanonpath()\fR\*(R".
393.Sp
394No checks against the filesystem are made. On \s-1VMS\s0, there is
395interaction with the working environment, as logicals and
396macros are expanded.
397.Sp
398Based on code written by Shigio Yamaguchi.
399.PP
400For further information, please see File::Spec::Unix,
401File::Spec::Mac, File::Spec::OS2, File::Spec::Win32, or
402File::Spec::VMS.
403.SH "SEE ALSO"
404.IX Header "SEE ALSO"
405File::Spec::Unix, File::Spec::Mac, File::Spec::OS2,
406File::Spec::Win32, File::Spec::VMS, File::Spec::Functions,
407ExtUtils::MakeMaker
408.SH "AUTHORS"
409.IX Header "AUTHORS"
410Kenneth Albanowski <kjahds@kjahds.com>, Andy Dougherty
411<doughera@lafcol.lafayette.edu>, Andreas Ko\*:nig
412<A.Koenig@franz.ww.TU\-Berlin.DE>, Tim Bunce <Tim.Bunce@ig.co.uk.
413\&\s-1VMS\s0 support by Charles Bailey <bailey@newman.upenn.edu>.
414\&\s-1OS/2\s0 support by Ilya Zakharevich <ilya@math.ohio\-state.edu>.
415Mac support by Paul Schinder <schinder@pobox.com>, and Thomas Wegner
416<wegner_thomas@yahoo.com>. \fIabs2rel()\fR and \fIrel2abs()\fR written by Shigio
417Yamaguchi <shigio@tamacom.com>, modified by Barrie Slaymaker
418<barries@slaysys.com>. \fIsplitpath()\fR, \fIsplitdir()\fR, \fIcatpath()\fR and
419\&\fIcatdir()\fR by Barrie Slaymaker.