| 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::Unix 3" |
| 132 | .TH File::Spec::Unix 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide" |
| 133 | .SH "NAME" |
| 134 | File::Spec::Unix \- File::Spec for Unix, base for other File::Spec modules |
| 135 | .SH "SYNOPSIS" |
| 136 | .IX Header "SYNOPSIS" |
| 137 | .Vb 1 |
| 138 | \& require File::Spec::Unix; # Done automatically by File::Spec |
| 139 | .Ve |
| 140 | .SH "DESCRIPTION" |
| 141 | .IX Header "DESCRIPTION" |
| 142 | Methods for manipulating file specifications. Other File::Spec |
| 143 | modules, such as File::Spec::Mac, inherit from File::Spec::Unix and |
| 144 | override specific methods. |
| 145 | .SH "METHODS" |
| 146 | .IX Header "METHODS" |
| 147 | .IP "\fIcanonpath()\fR" 2 |
| 148 | .IX Item "canonpath()" |
| 149 | No physical check on the filesystem, but a logical cleanup of a |
| 150 | path. On \s-1UNIX\s0 eliminates successive slashes and successive \*(L"/.\*(R". |
| 151 | .Sp |
| 152 | .Vb 1 |
| 153 | \& $cpath = File::Spec->canonpath( $path ) ; |
| 154 | .Ve |
| 155 | .Sp |
| 156 | Note that this does *not* collapse \fIx/../y\fR sections into \fIy\fR. This |
| 157 | is by design. If \fI/foo\fR on your system is a symlink to \fI/bar/baz\fR, |
| 158 | then \fI/foo/../quux\fR is actually \fI/bar/quux\fR, not \fI/quux\fR as a naive |
| 159 | \&\fI../\fR\-removal would give you. If you want to do this kind of |
| 160 | processing, you probably want \f(CW\*(C`Cwd\*(C'\fR's \f(CW\*(C`realpath()\*(C'\fR function to |
| 161 | actually traverse the filesystem cleaning up paths like this. |
| 162 | .IP "\fIcatdir()\fR" 2 |
| 163 | .IX Item "catdir()" |
| 164 | Concatenate two or more directory names to form a complete path ending |
| 165 | with a directory. But remove the trailing slash from the resulting |
| 166 | string, because it doesn't look good, isn't necessary and confuses |
| 167 | \&\s-1OS2\s0. Of course, if this is the root directory, don't cut off the |
| 168 | trailing slash :\-) |
| 169 | .IP "catfile" 2 |
| 170 | .IX Item "catfile" |
| 171 | Concatenate one or more directory names and a filename to form a |
| 172 | complete path ending with a filename |
| 173 | .IP "curdir" 2 |
| 174 | .IX Item "curdir" |
| 175 | Returns a string representation of the current directory. \*(L".\*(R" on \s-1UNIX\s0. |
| 176 | .IP "devnull" 2 |
| 177 | .IX Item "devnull" |
| 178 | Returns a string representation of the null device. \*(L"/dev/null\*(R" on \s-1UNIX\s0. |
| 179 | .IP "rootdir" 2 |
| 180 | .IX Item "rootdir" |
| 181 | Returns a string representation of the root directory. \*(L"/\*(R" on \s-1UNIX\s0. |
| 182 | .IP "tmpdir" 2 |
| 183 | .IX Item "tmpdir" |
| 184 | Returns a string representation of the first writable directory from |
| 185 | the following list or the current directory if none from the list are |
| 186 | writable: |
| 187 | .Sp |
| 188 | .Vb 2 |
| 189 | \& $ENV{TMPDIR} |
| 190 | \& /tmp |
| 191 | .Ve |
| 192 | .Sp |
| 193 | Since perl 5.8.0, if running under taint mode, and if \f(CW$ENV\fR{\s-1TMPDIR\s0} |
| 194 | is tainted, it is not used. |
| 195 | .IP "updir" 2 |
| 196 | .IX Item "updir" |
| 197 | Returns a string representation of the parent directory. \*(L"..\*(R" on \s-1UNIX\s0. |
| 198 | .IP "no_upwards" 2 |
| 199 | .IX Item "no_upwards" |
| 200 | Given a list of file names, strip out those that refer to a parent |
| 201 | directory. (Does not strip symlinks, only '.', '..', and equivalents.) |
| 202 | .IP "case_tolerant" 2 |
| 203 | .IX Item "case_tolerant" |
| 204 | Returns a true or false value indicating, respectively, that alphabetic |
| 205 | is not or is significant when comparing file specifications. |
| 206 | .IP "file_name_is_absolute" 2 |
| 207 | .IX Item "file_name_is_absolute" |
| 208 | Takes as argument a path and returns true if it is an absolute path. |
| 209 | .Sp |
| 210 | This does not consult the local filesystem on Unix, Win32, \s-1OS/2\s0 or Mac |
| 211 | \&\s-1OS\s0 (Classic). It does consult the working environment for \s-1VMS\s0 (see |
| 212 | \&\*(L"file_name_is_absolute\*(R" in File::Spec::VMS). |
| 213 | .IP "path" 2 |
| 214 | .IX Item "path" |
| 215 | Takes no argument, returns the environment variable \s-1PATH\s0 as an array. |
| 216 | .IP "join" 2 |
| 217 | .IX Item "join" |
| 218 | join is the same as catfile. |
| 219 | .IP "splitpath" 2 |
| 220 | .IX Item "splitpath" |
| 221 | .Vb 2 |
| 222 | \& ($volume,$directories,$file) = File::Spec->splitpath( $path ); |
| 223 | \& ($volume,$directories,$file) = File::Spec->splitpath( $path, $no_file ); |
| 224 | .Ve |
| 225 | .Sp |
| 226 | Splits a path into volume, directory, and filename portions. On systems |
| 227 | with no concept of volume, returns '' for volume. |
| 228 | .Sp |
| 229 | For systems with no syntax differentiating filenames from directories, |
| 230 | assumes that the last file is a path unless \f(CW$no_file\fR is true or a |
| 231 | trailing separator or /. or /.. is present. On Unix this means that \f(CW$no_file\fR |
| 232 | true makes this return ( '', \f(CW$path\fR, '' ). |
| 233 | .Sp |
| 234 | The directory portion may or may not be returned with a trailing '/'. |
| 235 | .Sp |
| 236 | The results can be passed to \*(L"\fIcatpath()\fR\*(R" to get back a path equivalent to |
| 237 | (usually identical to) the original path. |
| 238 | .IP "splitdir" 2 |
| 239 | .IX Item "splitdir" |
| 240 | The opposite of \*(L"\fIcatdir()\fR\*(R". |
| 241 | .Sp |
| 242 | .Vb 1 |
| 243 | \& @dirs = File::Spec->splitdir( $directories ); |
| 244 | .Ve |
| 245 | .Sp |
| 246 | $directories must be only the directory portion of the path on systems |
| 247 | that have the concept of a volume or that have path syntax that differentiates |
| 248 | files from directories. |
| 249 | .Sp |
| 250 | Unlike just splitting the directories on the separator, empty |
| 251 | directory names (\f(CW''\fR) can be returned, because these are significant |
| 252 | on some OSs. |
| 253 | .Sp |
| 254 | On Unix, |
| 255 | .Sp |
| 256 | .Vb 1 |
| 257 | \& File::Spec->splitdir( "/a/b//c/" ); |
| 258 | .Ve |
| 259 | .Sp |
| 260 | Yields: |
| 261 | .Sp |
| 262 | .Vb 1 |
| 263 | \& ( '', 'a', 'b', '', 'c', '' ) |
| 264 | .Ve |
| 265 | .IP "\fIcatpath()\fR" 2 |
| 266 | .IX Item "catpath()" |
| 267 | Takes volume, directory and file portions and returns an entire path. Under |
| 268 | Unix, \f(CW$volume\fR is ignored, and directory and file are concatenated. A '/' is |
| 269 | inserted if needed (though if the directory portion doesn't start with |
| 270 | \&'/' it is not added). On other OSs, \f(CW$volume\fR is significant. |
| 271 | .IP "abs2rel" 2 |
| 272 | .IX Item "abs2rel" |
| 273 | Takes a destination path and an optional base path returns a relative path |
| 274 | from the base path to the destination path: |
| 275 | .Sp |
| 276 | .Vb 2 |
| 277 | \& $rel_path = File::Spec->abs2rel( $path ) ; |
| 278 | \& $rel_path = File::Spec->abs2rel( $path, $base ) ; |
| 279 | .Ve |
| 280 | .Sp |
| 281 | If \f(CW$base\fR is not present or '', then \fIcwd()\fR is used. If \f(CW$base\fR is |
| 282 | relative, then it is converted to absolute form using |
| 283 | \&\*(L"\fIrel2abs()\fR\*(R". This means that it is taken to be relative to |
| 284 | \&\fIcwd()\fR. |
| 285 | .Sp |
| 286 | On systems that have a grammar that indicates filenames, this ignores the |
| 287 | \&\f(CW$base\fR filename. Otherwise all path components are assumed to be |
| 288 | directories. |
| 289 | .Sp |
| 290 | If \f(CW$path\fR is relative, it is converted to absolute form using \*(L"\fIrel2abs()\fR\*(R". |
| 291 | This means that it is taken to be relative to \fIcwd()\fR. |
| 292 | .Sp |
| 293 | No checks against the filesystem are made. On \s-1VMS\s0, there is |
| 294 | interaction with the working environment, as logicals and |
| 295 | macros are expanded. |
| 296 | .Sp |
| 297 | Based on code written by Shigio Yamaguchi. |
| 298 | .IP "\fIrel2abs()\fR" 2 |
| 299 | .IX Item "rel2abs()" |
| 300 | Converts a relative path to an absolute path. |
| 301 | .Sp |
| 302 | .Vb 2 |
| 303 | \& $abs_path = File::Spec->rel2abs( $path ) ; |
| 304 | \& $abs_path = File::Spec->rel2abs( $path, $base ) ; |
| 305 | .Ve |
| 306 | .Sp |
| 307 | If \f(CW$base\fR is not present or '', then \fIcwd()\fR is used. If \f(CW$base\fR is |
| 308 | relative, then it is converted to absolute form using |
| 309 | \&\*(L"\fIrel2abs()\fR\*(R". This means that it is taken to be relative to |
| 310 | \&\fIcwd()\fR. |
| 311 | .Sp |
| 312 | On systems that have a grammar that indicates filenames, this ignores |
| 313 | the \f(CW$base\fR filename. Otherwise all path components are assumed to be |
| 314 | directories. |
| 315 | .Sp |
| 316 | If \f(CW$path\fR is absolute, it is cleaned up and returned using \*(L"\fIcanonpath()\fR\*(R". |
| 317 | .Sp |
| 318 | No checks against the filesystem are made. On \s-1VMS\s0, there is |
| 319 | interaction with the working environment, as logicals and |
| 320 | macros are expanded. |
| 321 | .Sp |
| 322 | Based on code written by Shigio Yamaguchi. |
| 323 | .SH "COPYRIGHT" |
| 324 | .IX Header "COPYRIGHT" |
| 325 | Copyright (c) 2004 by the Perl 5 Porters. All rights reserved. |
| 326 | .PP |
| 327 | This program is free software; you can redistribute it and/or modify |
| 328 | it under the same terms as Perl itself. |
| 329 | .SH "SEE ALSO" |
| 330 | .IX Header "SEE ALSO" |
| 331 | File::Spec |