other versions
- wheezy 5.14.2-21+deb7u3
- jessie 5.20.2-3+deb8u6
- testing 5.24.1-3
- unstable 5.24.1-3
- experimental 5.26.0-1
other sections
File::Spec::Unix(3perl) | Perl Programmers Reference Guide | File::Spec::Unix(3perl) |
NAME¶
File::Spec::Unix - File::Spec for Unix, base for other File::Spec modulesSYNOPSIS¶
require File::Spec::Unix; # Done automatically by File::Spec
DESCRIPTION¶
Methods for manipulating file specifications. Other File::Spec modules, such as File::Spec::Mac, inherit from File::Spec::Unix and override specific methods.METHODS¶
- canonpath()
- No physical check on the filesystem, but a logical cleanup
of a path. On UNIX eliminates successive slashes and successive
"/.".
$cpath = File::Spec->canonpath( $path ) ;
- catdir()
- Concatenate two or more directory names to form a complete path ending with a directory. But remove the trailing slash from the resulting string, because it doesn't look good, isn't necessary and confuses OS2. Of course, if this is the root directory, don't cut off the trailing slash :-)
- catfile
- Concatenate one or more directory names and a filename to form a complete path ending with a filename
- curdir
- Returns a string representation of the current directory. "." on UNIX.
- devnull
- Returns a string representation of the null device. "/dev/null" on UNIX.
- rootdir
- Returns a string representation of the root directory. "/" on UNIX.
- tmpdir
- Returns a string representation of the first writable
directory from the following list or the current directory if none from
the list are writable:
$ENV{TMPDIR} /tmp
- updir
- Returns a string representation of the parent directory. ".." on UNIX.
- no_upwards
- Given a list of file names, strip out those that refer to a parent directory. (Does not strip symlinks, only '.', '..', and equivalents.)
- case_tolerant
- Returns a true or false value indicating, respectively, that alphabetic is not or is significant when comparing file specifications.
- file_name_is_absolute
- Takes as argument a path and returns true if it is an
absolute path.
- path
- Takes no argument, returns the environment variable PATH as an array.
- join
- join is the same as catfile.
- splitpath
-
($volume,$directories,$file) = File::Spec->splitpath( $path ); ($volume,$directories,$file) = File::Spec->splitpath( $path, $no_file );
- splitdir
- The opposite of "catdir()".
@dirs = File::Spec->splitdir( $directories );
File::Spec->splitdir( "/a/b//c/" );
( '', 'a', 'b', '', 'c', '' )
- catpath()
- Takes volume, directory and file portions and returns an entire path. Under Unix, $volume is ignored, and directory and file are concatenated. A '/' is inserted if needed (though if the directory portion doesn't start with '/' it is not added). On other OSs, $volume is significant.
- abs2rel
- Takes a destination path and an optional base path returns
a relative path from the base path to the destination path:
$rel_path = File::Spec->abs2rel( $path ) ; $rel_path = File::Spec->abs2rel( $path, $base ) ;
- rel2abs()
- Converts a relative path to an absolute path.
$abs_path = File::Spec->rel2abs( $path ) ; $abs_path = File::Spec->rel2abs( $path, $base ) ;
COPYRIGHT¶
Copyright (c) 2004 by the Perl 5 Porters. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.SEE ALSO¶
File::Spec2011-09-26 | perl v5.14.2 |