This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Eliminate eliminate_macros and fixpath.
[perl5.git] / dist / PathTools / lib / File / Spec / Functions.pm
CommitLineData
5c609535
JD
1package File::Spec::Functions;
2
3use File::Spec;
4use strict;
5
07824bd1 6use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
b4296952 7
0a660800 8$VERSION = '3.54';
3d2a0adf 9$VERSION =~ tr/_//;
5c609535
JD
10
11require Exporter;
12
13@ISA = qw(Exporter);
14
15@EXPORT = qw(
16 canonpath
17 catdir
18 catfile
19 curdir
5c609535 20 rootdir
5c609535
JD
21 updir
22 no_upwards
23 file_name_is_absolute
24 path
f505c983
GS
25);
26
27@EXPORT_OK = qw(
28 devnull
29 tmpdir
5c609535
JD
30 splitpath
31 splitdir
32 catpath
33 abs2rel
34 rel2abs
e021ab8e 35 case_tolerant
5c609535
JD
36);
37
817e423a
GS
38%EXPORT_TAGS = ( ALL => [ @EXPORT_OK, @EXPORT ] );
39
07f43755
Z
40require File::Spec::Unix;
41my %udeps = (
42 canonpath => [],
43 catdir => [qw(canonpath)],
44 catfile => [qw(canonpath catdir)],
45 case_tolerant => [],
46 curdir => [],
47 devnull => [],
48 rootdir => [],
49 updir => [],
50);
51
f505c983
GS
52foreach my $meth (@EXPORT, @EXPORT_OK) {
53 my $sub = File::Spec->can($meth);
5c609535 54 no strict 'refs';
07f43755
Z
55 if (exists($udeps{$meth}) && $sub == File::Spec::Unix->can($meth) &&
56 !(grep {
57 File::Spec->can($_) != File::Spec::Unix->can($_)
58 } @{$udeps{$meth}}) &&
59 defined(&{"File::Spec::Unix::_fn_$meth"})) {
60 *{$meth} = \&{"File::Spec::Unix::_fn_$meth"};
61 } else {
62 *{$meth} = sub {&$sub('File::Spec', @_)};
63 }
5c609535
JD
64}
65
66
671;
68__END__
69
70=head1 NAME
71
72File::Spec::Functions - portably perform operations on file names
73
74=head1 SYNOPSIS
75
76 use File::Spec::Functions;
77 $x = catfile('a','b');
78
79=head1 DESCRIPTION
80
81This module exports convenience functions for all of the class methods
82provided by File::Spec.
83
84For a reference of available functions, please consult L<File::Spec::Unix>,
85which contains the entire set, and which is inherited by the modules for
86other platforms. For further information, please see L<File::Spec::Mac>,
87L<File::Spec::OS2>, L<File::Spec::Win32>, or L<File::Spec::VMS>.
88
89=head2 Exports
90
91The following functions are exported by default.
92
93 canonpath
94 catdir
95 catfile
96 curdir
5c609535 97 rootdir
5c609535
JD
98 updir
99 no_upwards
100 file_name_is_absolute
101 path
f505c983
GS
102
103
104The following functions are exported only by request.
105
106 devnull
107 tmpdir
5c609535
JD
108 splitpath
109 splitdir
110 catpath
111 abs2rel
112 rel2abs
e021ab8e 113 case_tolerant
5c609535 114
817e423a
GS
115All the functions may be imported using the C<:ALL> tag.
116
99f36a73
RGS
117=head1 COPYRIGHT
118
119Copyright (c) 2004 by the Perl 5 Porters. All rights reserved.
120
121This program is free software; you can redistribute it and/or modify
122it under the same terms as Perl itself.
123
5c609535
JD
124=head1 SEE ALSO
125
126File::Spec, File::Spec::Unix, File::Spec::Mac, File::Spec::OS2,
127File::Spec::Win32, File::Spec::VMS, ExtUtils::MakeMaker
99f36a73
RGS
128
129=cut
130