Commit | Line | Data |
270d1e39 |
1 | package File::Spec; |
2 | |
3 | require 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 | |
14 | use strict; |
15 | use vars qw(@ISA $VERSION $Verbose); |
16 | |
17 | $VERSION = '0.6'; |
18 | |
19 | $Verbose = 0; |
20 | |
21 | require File::Spec::Unix; |
22 | |
23 | |
24 | sub 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 | |
46 | 1; |
47 | __END__ |
48 | |
49 | =head1 NAME |
50 | |
51 | File::Spec - portably perform operations on file names |
52 | |
53 | =head1 SYNOPSIS |
54 | |
55 | C<use File::Spec;> |
56 | |
57 | C<$x=File::Spec-E<gt>catfile('a','b','c');> |
58 | |
59 | which returns 'a/b/c' under Unix. |
60 | |
61 | =head1 DESCRIPTION |
62 | |
63 | This module is designed to support operations commonly performed on file |
64 | specifications (usually called "file names", but not to be confused with the |
65 | contents of a file, or Perl's file handles), such as concatenating several |
66 | directory and file names into a single path, or determining whether a path |
67 | is rooted. It is based on code directly taken from MakeMaker 5.17, code |
68 | written by Andreas KE<ouml>nig, Andy Dougherty, Charles Bailey, Ilya |
69 | Zakharevich, Paul Schinder, and others. |
70 | |
71 | Since these functions are different for most operating systems, each set of |
72 | OS 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 | |
80 | The module appropriate for the current OS is automatically loaded by |
81 | File::Spec. Since some modules (like VMS) make use of OS specific |
82 | facilities, it may not be possible to load all modules under all operating |
83 | systems. |
84 | |
85 | Since File::Spec is object oriented, subroutines should not called directly, |
86 | as in: |
87 | |
88 | File::Spec::catfile('a','b'); |
89 | |
90 | but rather as class methods: |
91 | |
92 | File::Spec->catfile('a','b'); |
93 | |
94 | For a reference of available functions, pleaes consult L<File::Spec::Unix>, |
95 | which contains the entire set, and inherited by the modules for other |
96 | platforms. For further information, please see L<File::Spec::Mac>, |
97 | L<File::Spec::OS2>, L<File::Spec::Win32>, or L<File::Spec::VMS>. |
98 | |
99 | =head1 SEE ALSO |
100 | |
101 | File::Spec::Unix, File::Spec::Mac, File::Spec::OS2, File::Spec::Win32, |
102 | File::Spec::VMS, ExtUtils::MakeMaker |
103 | |
104 | =head1 AUTHORS |
105 | |
106 | Kenneth 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 |
109 | support by Charles Bailey <F<bailey@genetics.upenn.edu>>. OS/2 support by |
110 | Ilya Zakharevich <F<ilya@math.ohio-state.edu>>. Mac support by Paul Schinder |
111 | <F<schinder@pobox.com>>. |
112 | |
113 | =cut |
114 | |
115 | |
116 | 1; |