File::Spec - portably perform operations on file names
use File::Spec; $x=File::Spec->catfile('a', 'b', 'c');
which returns 'a/b/c' under Unix. Or:
use File::Spec::Functions; $x = catfile('a', 'b', 'c');
This module is designed to support operations commonly performed on file specifications (usually called "file names", but not to be confused with the contents of a file, or Perl's file handles), such as concatenating several directory and file names into a single path, or determining whether a path is rooted. It is based on code directly taken from MakeMaker 5.17, code written by Andreas König, Andy Dougherty, Charles Bailey, Ilya Zakharevich, Paul Schinder, and others.
Since these functions are different for most operating systems, each set of OS specific routines is available in a separate module, including:
File::Spec::Unix File::Spec::Mac File::Spec::OS2 File::Spec::Win32 File::Spec::VMS
The module appropriate for the current OS is automatically loaded by File::Spec. Since some modules (like VMS) make use of facilities only under that OS, it may not be possible to load all modules under all operating systems.
Since File::Spec is object oriented, subroutines should not called directly, as in:
but rather as class methods:
Alternatively, File::Spec::Functions can be used instead, which exports functions for all of the class methods provided by File::Spec, including catfile, so you may say:
use File::Spec::Functions; catfile('a','b');
For a reference of available functions, pleaes consult File::Spec::Unix, which contains the entire set, and which is inherited by the modules for other platforms. For further information, please see File::Spec::Mac, File::Spec::OS2, File::Spec::Win32, or File::Spec::VMS.
Kenneth Albanowski <firstname.lastname@example.org>, Andy Dougherty <email@example.com>, Andreas König <A.Koenig@franz.ww.TU-Berlin.DE>, Tim Bunce <Tim.Bunce@ig.co.uk>. VMS support by Charles Bailey <firstname.lastname@example.org>. OS/2 support by Ilya Zakharevich <email@example.com>. Mac support by Paul Schinder <firstname.lastname@example.org>.