This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add File-Spec-0.6 from CPAN
[perl5.git] / lib / File / Spec.pm
CommitLineData
270d1e39
GS
1package File::Spec;
2
3require Exporter;
4
5@ISA = qw(Exporter);
6# Items to export into callers namespace by default. Note: do not export
7# names by default without a very good reason. Use EXPORT_OK instead.
8# Do not simply export all your public functions/methods/constants.
9@EXPORT = qw(
10
11);
12@EXPORT_OK = qw($Verbose);
13
14use strict;
15use vars qw(@ISA $VERSION $Verbose);
16
17$VERSION = '0.6';
18
19$Verbose = 0;
20
21require File::Spec::Unix;
22
23
24sub load {
25 my($class,$OS) = @_;
26 if ($OS eq 'VMS') {
27 require File::Spec::VMS;
28 require VMS::Filespec;
29 'File::Spec::VMS'
30 } elsif ($OS eq 'os2') {
31 require File::Spec::OS2;
32 'File::Spec::OS2'
33 } elsif ($OS eq 'MacOS') {
34 require File::Spec::Mac;
35 'File::Spec::Mac'
36 } elsif ($OS eq 'MSWin32') {
37 require File::Spec::Win32;
38 'File::Spec::Win32'
39 } else {
40 'File::Spec::Unix'
41 }
42}
43
44@ISA = load('File::Spec', $^O);
45
461;
47__END__
48
49=head1 NAME
50
51File::Spec - portably perform operations on file names
52
53=head1 SYNOPSIS
54
55C<use File::Spec;>
56
57C<$x=File::Spec-E<gt>catfile('a','b','c');>
58
59which returns 'a/b/c' under Unix.
60
61=head1 DESCRIPTION
62
63This module is designed to support operations commonly performed on file
64specifications (usually called "file names", but not to be confused with the
65contents of a file, or Perl's file handles), such as concatenating several
66directory and file names into a single path, or determining whether a path
67is rooted. It is based on code directly taken from MakeMaker 5.17, code
68written by Andreas KE<ouml>nig, Andy Dougherty, Charles Bailey, Ilya
69Zakharevich, Paul Schinder, and others.
70
71Since these functions are different for most operating systems, each set of
72OS specific routines is available in a separate module, including:
73
74 File::Spec::Unix
75 File::Spec::Mac
76 File::Spec::OS2
77 File::Spec::Win32
78 File::Spec::VMS
79
80The module appropriate for the current OS is automatically loaded by
81File::Spec. Since some modules (like VMS) make use of OS specific
82facilities, it may not be possible to load all modules under all operating
83systems.
84
85Since File::Spec is object oriented, subroutines should not called directly,
86as in:
87
88 File::Spec::catfile('a','b');
89
90but rather as class methods:
91
92 File::Spec->catfile('a','b');
93
94For a reference of available functions, pleaes consult L<File::Spec::Unix>,
95which contains the entire set, and inherited by the modules for other
96platforms. For further information, please see L<File::Spec::Mac>,
97L<File::Spec::OS2>, L<File::Spec::Win32>, or L<File::Spec::VMS>.
98
99=head1 SEE ALSO
100
101File::Spec::Unix, File::Spec::Mac, File::Spec::OS2, File::Spec::Win32,
102File::Spec::VMS, ExtUtils::MakeMaker
103
104=head1 AUTHORS
105
106Kenneth Albanowski <F<kjahds@kjahds.com>>, Andy Dougherty
107<F<doughera@lafcol.lafayette.edu>>, Andreas KE<ouml>nig
108<F<A.Koenig@franz.ww.TU-Berlin.DE>>, Tim Bunce <F<Tim.Bunce@ig.co.uk>>. VMS
109support by Charles Bailey <F<bailey@genetics.upenn.edu>>. OS/2 support by
110Ilya Zakharevich <F<ilya@math.ohio-state.edu>>. Mac support by Paul Schinder
111<F<schinder@pobox.com>>.
112
113=cut
114
115
1161;