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