This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH 1 of 3] $] is deprecated - eliminate from core tests
[perl5.git] / lib / File / Spec.pm
CommitLineData
270d1e39
GS
1package File::Spec;
2
270d1e39 3use strict;
f168a5e7 4our(@ISA, $VERSION);
270d1e39 5
3c32ced9 6$VERSION = 0.82 ;
270d1e39 7
cbc7acb0
JD
8my %module = (MacOS => 'Mac',
9 MSWin32 => 'Win32',
10 os2 => 'OS2',
fa6a1c44
OF
11 VMS => 'VMS',
12 epoc => 'Epoc');
cbc7acb0
JD
13
14my $module = $module{$^O} || 'Unix';
15require "File/Spec/$module.pm";
16@ISA = ("File::Spec::$module");
270d1e39
GS
17
181;
19__END__
20
21=head1 NAME
22
23File::Spec - portably perform operations on file names
24
25=head1 SYNOPSIS
26
5c609535 27 use File::Spec;
270d1e39 28
5c609535 29 $x=File::Spec->catfile('a', 'b', 'c');
270d1e39 30
5c609535
JD
31which returns 'a/b/c' under Unix. Or:
32
33 use File::Spec::Functions;
34
35 $x = catfile('a', 'b', 'c');
270d1e39
GS
36
37=head1 DESCRIPTION
38
39This module is designed to support operations commonly performed on file
40specifications (usually called "file names", but not to be confused with the
41contents of a file, or Perl's file handles), such as concatenating several
42directory and file names into a single path, or determining whether a path
43is rooted. It is based on code directly taken from MakeMaker 5.17, code
44written by Andreas KE<ouml>nig, Andy Dougherty, Charles Bailey, Ilya
45Zakharevich, Paul Schinder, and others.
46
47Since these functions are different for most operating systems, each set of
48OS specific routines is available in a separate module, including:
49
50 File::Spec::Unix
51 File::Spec::Mac
52 File::Spec::OS2
53 File::Spec::Win32
54 File::Spec::VMS
55
56The module appropriate for the current OS is automatically loaded by
5c609535
JD
57File::Spec. Since some modules (like VMS) make use of facilities available
58only under that OS, it may not be possible to load all modules under all
59operating systems.
270d1e39
GS
60
61Since File::Spec is object oriented, subroutines should not called directly,
62as in:
63
64 File::Spec::catfile('a','b');
5c609535 65
270d1e39
GS
66but rather as class methods:
67
68 File::Spec->catfile('a','b');
69
5c609535
JD
70For simple uses, L<File::Spec::Functions> provides convenient functional
71forms of these methods.
72
73For a list of available methods, please consult L<File::Spec::Unix>,
74which contains the entire set, and which is inherited by the modules for
75other platforms. For further information, please see L<File::Spec::Mac>,
270d1e39
GS
76L<File::Spec::OS2>, L<File::Spec::Win32>, or L<File::Spec::VMS>.
77
78=head1 SEE ALSO
79
80File::Spec::Unix, File::Spec::Mac, File::Spec::OS2, File::Spec::Win32,
5c609535 81File::Spec::VMS, File::Spec::Functions, ExtUtils::MakeMaker
270d1e39
GS
82
83=head1 AUTHORS
84
85Kenneth Albanowski <F<kjahds@kjahds.com>>, Andy Dougherty
86<F<doughera@lafcol.lafayette.edu>>, Andreas KE<ouml>nig
87<F<A.Koenig@franz.ww.TU-Berlin.DE>>, Tim Bunce <F<Tim.Bunce@ig.co.uk>>. VMS
bd3fa61c 88support by Charles Bailey <F<bailey@newman.upenn.edu>>. OS/2 support by
270d1e39 89Ilya Zakharevich <F<ilya@math.ohio-state.edu>>. Mac support by Paul Schinder
f9d788eb
GS
90<F<schinder@pobox.com>>. abs2rel() and rel2abs() written by
91Shigio Yamaguchi <F<shigio@tamacom.com>>, modified by Barrie Slaymaker
92<F<barries@slaysys.com>>. splitpath(), splitdir(), catpath() and catdir()
93by Barrie Slaymaker.