File::Spec::Unix - File::Spec for Unix, base for other File::Spec modules
require File::Spec::Unix; # Done automatically by File::Spec
Methods for manipulating file specifications. Other File::Spec modules, such as File::Spec::Mac, inherit from File::Spec::Unix and override specific methods.
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 ) ;
Note that this does *not* collapse x/../y sections into y. This is by design. If /foo on your system is a symlink to /bar/baz, then /foo/../quux is actually /bar/quux, not /quux as a naive ../-removal would give you. If you want to do this kind of processing, you probably want Cwd
's realpath()
function to actually traverse the filesystem cleaning up paths like this.
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 :-)
Concatenate one or more directory names and a filename to form a complete path ending with a filename
Returns a string representation of the current directory. "." on UNIX.
Returns a string representation of the null device. "/dev/null" on UNIX.
Returns a string representation of the root directory. "/" on UNIX.
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
If running under taint mode, and if $ENV{TMPDIR} is tainted, it is not used.
Returns a string representation of the parent directory. ".." on UNIX.
Given a list of file names, strip out those that refer to a parent directory. (Does not strip symlinks, only '.', '..', and equivalents.)