Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / man3 / File::Spec.3
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
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 "2001-09-21" "perl v5.8.8" "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.Sp
206Note that this does *not* collapse \fIx/../y\fR sections into \fIy\fR. This
207is by design. If \fI/foo\fR on your system is a symlink to \fI/bar/baz\fR,
208then \fI/foo/../quux\fR is actually \fI/bar/quux\fR, not \fI/quux\fR as a naive
209\&\fI../\fR\-removal would give you. If you want to do this kind of
210processing, you probably want \f(CW\*(C`Cwd\*(C'\fR's \f(CW\*(C`realpath()\*(C'\fR function to
211actually traverse the filesystem cleaning up paths like this.
212.IP "catdir" 2
213.IX Item "catdir"
214Concatenate two or more directory names to form a complete path ending
215with a directory. But remove the trailing slash from the resulting
216string, because it doesn't look good, isn't necessary and confuses
217\&\s-1OS/2\s0. Of course, if this is the root directory, don't cut off the
218trailing slash :\-)
219.Sp
220.Vb 1
221\& $path = File::Spec->catdir( @directories );
222.Ve
223.IP "catfile" 2
224.IX Item "catfile"
225Concatenate one or more directory names and a filename to form a
226complete path ending with a filename
227.Sp
228.Vb 1
229\& $path = File::Spec->catfile( @directories, $filename );
230.Ve
231.IP "curdir" 2
232.IX Item "curdir"
233Returns a string representation of the current directory.
234.Sp
235.Vb 1
236\& $curdir = File::Spec->curdir();
237.Ve
238.IP "devnull" 2
239.IX Item "devnull"
240Returns a string representation of the null device.
241.Sp
242.Vb 1
243\& $devnull = File::Spec->devnull();
244.Ve
245.IP "rootdir" 2
246.IX Item "rootdir"
247Returns a string representation of the root directory.
248.Sp
249.Vb 1
250\& $rootdir = File::Spec->rootdir();
251.Ve
252.IP "tmpdir" 2
253.IX Item "tmpdir"
254Returns a string representation of the first writable directory from a
255list of possible temporary directories. Returns the current directory
256if no writable temporary directories are found. The list of directories
257checked depends on the platform; e.g. File::Spec::Unix checks \f(CW$ENV{TMPDIR}\fR
258(unless taint is on) and \fI/tmp\fR.
259.Sp
260.Vb 1
261\& $tmpdir = File::Spec->tmpdir();
262.Ve
263.IP "updir" 2
264.IX Item "updir"
265Returns a string representation of the parent directory.
266.Sp
267.Vb 1
268\& $updir = File::Spec->updir();
269.Ve
270.IP "no_upwards" 2
271.IX Item "no_upwards"
272Given a list of file names, strip out those that refer to a parent
273directory. (Does not strip symlinks, only '.', '..', and equivalents.)
274.Sp
275.Vb 1
276\& @paths = File::Spec->no_upwards( @paths );
277.Ve
278.IP "case_tolerant" 2
279.IX Item "case_tolerant"
280Returns a true or false value indicating, respectively, that alphabetic
281case is not or is significant when comparing file specifications.
282.Sp
283.Vb 1
284\& $is_case_tolerant = File::Spec->case_tolerant();
285.Ve
286.IP "file_name_is_absolute" 2
287.IX Item "file_name_is_absolute"
288Takes as its argument a path, and returns true if it is an absolute path.
289.Sp
290.Vb 1
291\& $is_absolute = File::Spec->file_name_is_absolute( $path );
292.Ve
293.Sp
294This does not consult the local filesystem on Unix, Win32, \s-1OS/2\s0, or
295Mac \s-1OS\s0 (Classic). It does consult the working environment for \s-1VMS\s0
296(see \*(L"file_name_is_absolute\*(R" in File::Spec::VMS).
297.IP "path" 2
298.IX Item "path"
299Takes no argument. Returns the environment variable \f(CW\*(C`PATH\*(C'\fR (or the local
300platform's equivalent) as a list.
301.Sp
302.Vb 1
303\& @PATH = File::Spec->path();
304.Ve
305.IP "join" 2
306.IX Item "join"
307join is the same as catfile.
308.IP "splitpath" 2
309.IX Item "splitpath"
310Splits a path in to volume, directory, and filename portions. On systems
311with no concept of volume, returns '' for volume.
312.Sp
313.Vb 2
314\& ($volume,$directories,$file) = File::Spec->splitpath( $path );
315\& ($volume,$directories,$file) = File::Spec->splitpath( $path, $no_file );
316.Ve
317.Sp
318For systems with no syntax differentiating filenames from directories,
319assumes that the last file is a path unless \f(CW$no_file\fR is true or a
320trailing separator or \fI/.\fR or \fI/..\fR is present. On Unix, this means that \f(CW$no_file\fR
321true makes this return ( '', \f(CW$path\fR, '' ).
322.Sp
323The directory portion may or may not be returned with a trailing '/'.
324.Sp
325The results can be passed to \*(L"\fIcatpath()\fR\*(R" to get back a path equivalent to
326(usually identical to) the original path.
327.IP "splitdir" 2
328.IX Item "splitdir"
329The opposite of \*(L"\fIcatdir()\fR\*(R".
330.Sp
331.Vb 1
332\& @dirs = File::Spec->splitdir( $directories );
333.Ve
334.Sp
335\&\f(CW$directories\fR must be only the directory portion of the path on systems
336that have the concept of a volume or that have path syntax that differentiates
337files from directories.
338.Sp
339Unlike just splitting the directories on the separator, empty
340directory names (\f(CW''\fR) can be returned, because these are significant
341on some OSes.
342.IP "\fIcatpath()\fR" 2
343.IX Item "catpath()"
344Takes volume, directory and file portions and returns an entire path. Under
345Unix, \f(CW$volume\fR is ignored, and directory and file are concatenated. A '/' is
346inserted if need be. On other OSes, \f(CW$volume\fR is significant.
347.Sp
348.Vb 1
349\& $full_path = File::Spec->catpath( $volume, $directory, $file );
350.Ve
351.IP "abs2rel" 2
352.IX Item "abs2rel"
353Takes a destination path and an optional base path returns a relative path
354from the base path to the destination path:
355.Sp
356.Vb 2
357\& $rel_path = File::Spec->abs2rel( $path ) ;
358\& $rel_path = File::Spec->abs2rel( $path, $base ) ;
359.Ve
360.Sp
361If \f(CW$base\fR is not present or '', then \fIcwd()\fR is used. If \f(CW$base\fR is
362relative, then it is converted to absolute form using
363\&\*(L"\fIrel2abs()\fR\*(R". This means that it is taken to be relative to
364\&\fIcwd()\fR.
365.Sp
366On systems with the concept of volume, if \f(CW$path\fR and \f(CW$base\fR appear to be
367on two different volumes, we will not attempt to resolve the two
368paths, and we will instead simply return \f(CW$path\fR. Note that previous
369versions of this module ignored the volume of \f(CW$base\fR, which resulted in
370garbage results part of the time.
371.Sp
372On systems that have a grammar that indicates filenames, this ignores the
373\&\f(CW$base\fR filename as well. Otherwise all path components are assumed to be
374directories.
375.Sp
376If \f(CW$path\fR is relative, it is converted to absolute form using \*(L"\fIrel2abs()\fR\*(R".
377This means that it is taken to be relative to \fIcwd()\fR.
378.Sp
379No checks against the filesystem are made. On \s-1VMS\s0, there is
380interaction with the working environment, as logicals and
381macros are expanded.
382.Sp
383Based on code written by Shigio Yamaguchi.
384.IP "\fIrel2abs()\fR" 2
385.IX Item "rel2abs()"
386Converts a relative path to an absolute path.
387.Sp
388.Vb 2
389\& $abs_path = File::Spec->rel2abs( $path ) ;
390\& $abs_path = File::Spec->rel2abs( $path, $base ) ;
391.Ve
392.Sp
393If \f(CW$base\fR is not present or '', then \fIcwd()\fR is used. If \f(CW$base\fR is relative,
394then it is converted to absolute form using \*(L"\fIrel2abs()\fR\*(R". This means that it
395is taken to be relative to \fIcwd()\fR.
396.Sp
397On systems with the concept of volume, if \f(CW$path\fR and \f(CW$base\fR appear to be
398on two different volumes, we will not attempt to resolve the two
399paths, and we will instead simply return \f(CW$path\fR. Note that previous
400versions of this module ignored the volume of \f(CW$base\fR, which resulted in
401garbage results part of the time.
402.Sp
403On systems that have a grammar that indicates filenames, this ignores the
404\&\f(CW$base\fR filename as well. Otherwise all path components are assumed to be
405directories.
406.Sp
407If \f(CW$path\fR is absolute, it is cleaned up and returned using \*(L"\fIcanonpath()\fR\*(R".
408.Sp
409No checks against the filesystem are made. On \s-1VMS\s0, there is
410interaction with the working environment, as logicals and
411macros are expanded.
412.Sp
413Based on code written by Shigio Yamaguchi.
414.PP
415For further information, please see File::Spec::Unix,
416File::Spec::Mac, File::Spec::OS2, File::Spec::Win32, or
417File::Spec::VMS.
418.SH "SEE ALSO"
419.IX Header "SEE ALSO"
420File::Spec::Unix, File::Spec::Mac, File::Spec::OS2,
421File::Spec::Win32, File::Spec::VMS, File::Spec::Functions,
422ExtUtils::MakeMaker
423.SH "AUTHOR"
424.IX Header "AUTHOR"
425Currently maintained by Ken Williams \f(CW\*(C`<KWILLIAMS@cpan.org>\*(C'\fR.
426.PP
427The vast majority of the code was written by
428Kenneth Albanowski \f(CW\*(C`<kjahds@kjahds.com>\*(C'\fR,
429Andy Dougherty \f(CW\*(C`<doughera@lafayette.edu>\*(C'\fR,
430Andreas Ko\*:nig \f(CW\*(C`<A.Koenig@franz.ww.TU\-Berlin.DE>\*(C'\fR,
431Tim Bunce \f(CW\*(C`<Tim.Bunce@ig.co.uk>\*(C'\fR.
432\&\s-1VMS\s0 support by Charles Bailey \f(CW\*(C`<bailey@newman.upenn.edu>\*(C'\fR.
433\&\s-1OS/2\s0 support by Ilya Zakharevich \f(CW\*(C`<ilya@math.ohio\-state.edu>\*(C'\fR.
434Mac support by Paul Schinder \f(CW\*(C`<schinder@pobox.com>\*(C'\fR, and
435Thomas Wegner \f(CW\*(C`<wegner_thomas@yahoo.com>\*(C'\fR.
436\&\fIabs2rel()\fR and \fIrel2abs()\fR written by Shigio Yamaguchi \f(CW\*(C`<shigio@tamacom.com>\*(C'\fR,
437modified by Barrie Slaymaker \f(CW\*(C`<barries@slaysys.com>\*(C'\fR.
438\&\fIsplitpath()\fR, \fIsplitdir()\fR, \fIcatpath()\fR and \fIcatdir()\fR by Barrie Slaymaker.
439.SH "COPYRIGHT"
440.IX Header "COPYRIGHT"
441Copyright (c) 2004 by the Perl 5 Porters. All rights reserved.
442.PP
443This program is free software; you can redistribute it and/or modify
444it under the same terms as Perl itself.