xref: /openbsd-src/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Functions.pm (revision 3d61058aa5c692477b6d18acfbbdb653a9930ff9)
16fb12b70Safresh1package File::Spec::Functions;
26fb12b70Safresh1
36fb12b70Safresh1use File::Spec;
46fb12b70Safresh1use strict;
56fb12b70Safresh1
6*3d61058aSafresh1our $VERSION = '3.91';
7b8851fccSafresh1$VERSION =~ tr/_//d;
86fb12b70Safresh1
96fb12b70Safresh1require Exporter;
106fb12b70Safresh1
119f11ffb7Safresh1our @ISA = qw(Exporter);
126fb12b70Safresh1
139f11ffb7Safresh1our @EXPORT = qw(
146fb12b70Safresh1	canonpath
156fb12b70Safresh1	catdir
166fb12b70Safresh1	catfile
176fb12b70Safresh1	curdir
186fb12b70Safresh1	rootdir
196fb12b70Safresh1	updir
206fb12b70Safresh1	no_upwards
216fb12b70Safresh1	file_name_is_absolute
226fb12b70Safresh1	path
236fb12b70Safresh1);
246fb12b70Safresh1
259f11ffb7Safresh1our @EXPORT_OK = qw(
266fb12b70Safresh1	devnull
276fb12b70Safresh1	tmpdir
286fb12b70Safresh1	splitpath
296fb12b70Safresh1	splitdir
306fb12b70Safresh1	catpath
316fb12b70Safresh1	abs2rel
326fb12b70Safresh1	rel2abs
336fb12b70Safresh1	case_tolerant
346fb12b70Safresh1);
356fb12b70Safresh1
369f11ffb7Safresh1our %EXPORT_TAGS = ( ALL => [ @EXPORT_OK, @EXPORT ] );
376fb12b70Safresh1
386fb12b70Safresh1require File::Spec::Unix;
396fb12b70Safresh1my %udeps = (
406fb12b70Safresh1    canonpath => [],
416fb12b70Safresh1    catdir => [qw(canonpath)],
426fb12b70Safresh1    catfile => [qw(canonpath catdir)],
436fb12b70Safresh1    case_tolerant => [],
446fb12b70Safresh1    curdir => [],
456fb12b70Safresh1    devnull => [],
466fb12b70Safresh1    rootdir => [],
476fb12b70Safresh1    updir => [],
486fb12b70Safresh1);
496fb12b70Safresh1
506fb12b70Safresh1foreach my $meth (@EXPORT, @EXPORT_OK) {
516fb12b70Safresh1    my $sub = File::Spec->can($meth);
526fb12b70Safresh1    no strict 'refs';
536fb12b70Safresh1    if (exists($udeps{$meth}) && $sub == File::Spec::Unix->can($meth) &&
546fb12b70Safresh1	    !(grep {
556fb12b70Safresh1		File::Spec->can($_) != File::Spec::Unix->can($_)
566fb12b70Safresh1	    } @{$udeps{$meth}}) &&
576fb12b70Safresh1	    defined(&{"File::Spec::Unix::_fn_$meth"})) {
586fb12b70Safresh1	*{$meth} = \&{"File::Spec::Unix::_fn_$meth"};
596fb12b70Safresh1    } else {
606fb12b70Safresh1	*{$meth} = sub {&$sub('File::Spec', @_)};
616fb12b70Safresh1    }
626fb12b70Safresh1}
636fb12b70Safresh1
646fb12b70Safresh1
656fb12b70Safresh11;
666fb12b70Safresh1__END__
676fb12b70Safresh1
686fb12b70Safresh1=head1 NAME
696fb12b70Safresh1
706fb12b70Safresh1File::Spec::Functions - portably perform operations on file names
716fb12b70Safresh1
726fb12b70Safresh1=head1 SYNOPSIS
736fb12b70Safresh1
746fb12b70Safresh1	use File::Spec::Functions;
75*3d61058aSafresh1	my $x = catfile('a', 'b');
766fb12b70Safresh1
776fb12b70Safresh1=head1 DESCRIPTION
786fb12b70Safresh1
796fb12b70Safresh1This module exports convenience functions for all of the class methods
806fb12b70Safresh1provided by File::Spec.
816fb12b70Safresh1
826fb12b70Safresh1For a reference of available functions, please consult L<File::Spec::Unix>,
836fb12b70Safresh1which contains the entire set, and which is inherited by the modules for
846fb12b70Safresh1other platforms. For further information, please see L<File::Spec::Mac>,
856fb12b70Safresh1L<File::Spec::OS2>, L<File::Spec::Win32>, or L<File::Spec::VMS>.
866fb12b70Safresh1
876fb12b70Safresh1=head2 Exports
886fb12b70Safresh1
896fb12b70Safresh1The following functions are exported by default.
906fb12b70Safresh1
916fb12b70Safresh1	canonpath
926fb12b70Safresh1	catdir
936fb12b70Safresh1	catfile
946fb12b70Safresh1	curdir
956fb12b70Safresh1	rootdir
966fb12b70Safresh1	updir
976fb12b70Safresh1	no_upwards
986fb12b70Safresh1	file_name_is_absolute
996fb12b70Safresh1	path
1006fb12b70Safresh1
1016fb12b70Safresh1
1026fb12b70Safresh1The following functions are exported only by request.
1036fb12b70Safresh1
1046fb12b70Safresh1	devnull
1056fb12b70Safresh1	tmpdir
1066fb12b70Safresh1	splitpath
1076fb12b70Safresh1	splitdir
1086fb12b70Safresh1	catpath
1096fb12b70Safresh1	abs2rel
1106fb12b70Safresh1	rel2abs
1116fb12b70Safresh1	case_tolerant
1126fb12b70Safresh1
1136fb12b70Safresh1All the functions may be imported using the C<:ALL> tag.
1146fb12b70Safresh1
1156fb12b70Safresh1=head1 COPYRIGHT
1166fb12b70Safresh1
1176fb12b70Safresh1Copyright (c) 2004 by the Perl 5 Porters.  All rights reserved.
1186fb12b70Safresh1
1196fb12b70Safresh1This program is free software; you can redistribute it and/or modify
1206fb12b70Safresh1it under the same terms as Perl itself.
1216fb12b70Safresh1
1226fb12b70Safresh1=head1 SEE ALSO
1236fb12b70Safresh1
1246fb12b70Safresh1File::Spec, File::Spec::Unix, File::Spec::Mac, File::Spec::OS2,
1256fb12b70Safresh1File::Spec::Win32, File::Spec::VMS, ExtUtils::MakeMaker
1266fb12b70Safresh1
1276fb12b70Safresh1=cut
1286fb12b70Safresh1
129