From: Jan Dubois Date: Mon, 1 Mar 1999 00:32:05 +0000 (+0100) Subject: slightly edited version of suggested patch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5c6095350fa4ff9d9ad1727b7c75dfb18822ef5a;p=p5sagit%2Fp5-mst-13.2.git slightly edited version of suggested patch Message-ID: <36dbcf2c.12325433@smtp1.ibm.net> Subject: Re: [PATCH 5.005_55] Cleanup of File::Spec module p4raw-id: //depot/perl@3042 --- diff --git a/MANIFEST b/MANIFEST index c0bc186..5f4d597 100644 --- a/MANIFEST +++ b/MANIFEST @@ -555,6 +555,7 @@ lib/File/DosGlob.pm Win32 DOS-globbing module lib/File/Find.pm Routines to do a find lib/File/Path.pm Do things like `mkdir -p' and `rm -r' lib/File/Spec.pm portable operations on file names +lib/File/Spec/Functions.pm Function interface to File::Spec object methods lib/File/Spec/Mac.pm portable operations on Mac file names lib/File/Spec/OS2.pm portable operations on OS2 file names lib/File/Spec/Unix.pm portable operations on Unix file names diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm index 9de9a80..b71e357 100644 --- a/lib/File/Spec.pm +++ b/lib/File/Spec.pm @@ -3,7 +3,7 @@ package File::Spec; use strict; use vars qw(@ISA $VERSION); -$VERSION = '0.6'; +$VERSION = '0.8'; my %module = (MacOS => 'Mac', MSWin32 => 'Win32', @@ -23,11 +23,15 @@ File::Spec - portably perform operations on file names =head1 SYNOPSIS -C + use File::Spec; -C<$x=File::Spec-Ecatfile('a','b','c');> + $x=File::Spec->catfile('a', 'b', 'c'); -which returns 'a/b/c' under Unix. +which returns 'a/b/c' under Unix. Or: + + use File::Spec::Functions; + + $x = catfile('a', 'b', 'c'); =head1 DESCRIPTION @@ -49,28 +53,31 @@ OS specific routines is available in a separate module, including: File::Spec::VMS The module appropriate for the current OS is automatically loaded by -File::Spec. Since some modules (like VMS) make use of OS specific -facilities, it may not be possible to load all modules under all operating -systems. +File::Spec. Since some modules (like VMS) make use of facilities available +only under that OS, it may not be possible to load all modules under all +operating systems. Since File::Spec is object oriented, subroutines should not called directly, as in: File::Spec::catfile('a','b'); - + but rather as class methods: File::Spec->catfile('a','b'); -For a reference of available functions, please consult L, -which contains the entire set, and inherited by the modules for other -platforms. For further information, please see L, +For simple uses, L provides convenient functional +forms of these methods. + +For a list of available methods, please consult L, +which contains the entire set, and which is inherited by the modules for +other platforms. For further information, please see L, L, L, or L. =head1 SEE ALSO File::Spec::Unix, File::Spec::Mac, File::Spec::OS2, File::Spec::Win32, -File::Spec::VMS, ExtUtils::MakeMaker +File::Spec::VMS, File::Spec::Functions, ExtUtils::MakeMaker =head1 AUTHORS diff --git a/lib/File/Spec/Functions.pm b/lib/File/Spec/Functions.pm new file mode 100644 index 0000000..77561ab --- /dev/null +++ b/lib/File/Spec/Functions.pm @@ -0,0 +1,83 @@ +package File::Spec::Functions; + +use File::Spec; +use strict; + +use vars qw(@ISA @EXPORT); + +require Exporter; + +@ISA = qw(Exporter); + +@EXPORT = qw( + canonpath + catdir + catfile + curdir + devnull + rootdir + tmpdir + updir + no_upwards + file_name_is_absolute + path + splitpath + splitdir + catpath + abs2rel + rel2abs +); + +foreach my $meth (@EXPORT) { + no strict 'refs'; + *{$meth} = File::Spec->can($meth); +} + + +1; +__END__ + +=head1 NAME + +File::Spec::Functions - portably perform operations on file names + +=head1 SYNOPSIS + + use File::Spec::Functions; + $x = catfile('a','b'); + +=head1 DESCRIPTION + +This module exports convenience functions for all of the class methods +provided by File::Spec. + +For a reference of available functions, please consult L, +which contains the entire set, and which is inherited by the modules for +other platforms. For further information, please see L, +L, L, or L. + +=head2 Exports + +The following functions are exported by default. + + canonpath + catdir + catfile + curdir + devnull + rootdir + tmpdir + updir + no_upwards + file_name_is_absolute + path + splitpath + splitdir + catpath + abs2rel + rel2abs + +=head1 SEE ALSO + +File::Spec, File::Spec::Unix, File::Spec::Mac, File::Spec::OS2, +File::Spec::Win32, File::Spec::VMS, ExtUtils::MakeMaker