diff options
Diffstat (limited to 'contrib/perl5/lib/File/Spec.pm')
-rw-r--r-- | contrib/perl5/lib/File/Spec.pm | 86 |
1 files changed, 31 insertions, 55 deletions
diff --git a/contrib/perl5/lib/File/Spec.pm b/contrib/perl5/lib/File/Spec.pm index 616dcbcb7a0d..40f5345140c7 100644 --- a/contrib/perl5/lib/File/Spec.pm +++ b/contrib/perl5/lib/File/Spec.pm @@ -1,47 +1,18 @@ package File::Spec; -require Exporter; - -@ISA = qw(Exporter); -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. -@EXPORT = qw( - -); -@EXPORT_OK = qw($Verbose); - use strict; -use vars qw(@ISA $VERSION $Verbose); - -$VERSION = '0.6'; - -$Verbose = 0; +use vars qw(@ISA $VERSION); -require File::Spec::Unix; +$VERSION = '0.8'; +my %module = (MacOS => 'Mac', + MSWin32 => 'Win32', + os2 => 'OS2', + VMS => 'VMS'); -sub load { - my($class,$OS) = @_; - if ($OS eq 'VMS') { - require File::Spec::VMS; - require VMS::Filespec; - 'File::Spec::VMS' - } elsif ($OS eq 'os2') { - require File::Spec::OS2; - 'File::Spec::OS2' - } elsif ($OS eq 'MacOS') { - require File::Spec::Mac; - 'File::Spec::Mac' - } elsif ($OS eq 'MSWin32') { - require File::Spec::Win32; - 'File::Spec::Win32' - } else { - 'File::Spec::Unix' - } -} - -@ISA = load('File::Spec', $^O); +my $module = $module{$^O} || 'Unix'; +require "File/Spec/$module.pm"; +@ISA = ("File::Spec::$module"); 1; __END__ @@ -52,11 +23,15 @@ File::Spec - portably perform operations on file names =head1 SYNOPSIS -C<use File::Spec;> + use File::Spec; + + $x=File::Spec->catfile('a', 'b', 'c'); + +which returns 'a/b/c' under Unix. Or: -C<$x=File::Spec-E<gt>catfile('a','b','c');> + use File::Spec::Functions; -which returns 'a/b/c' under Unix. + $x = catfile('a', 'b', 'c'); =head1 DESCRIPTION @@ -78,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<File::Spec::Unix>, -which contains the entire set, and inherited by the modules for other -platforms. For further information, please see L<File::Spec::Mac>, +For simple uses, L<File::Spec::Functions> provides convenient functional +forms of these methods. + +For a list of available methods, please consult L<File::Spec::Unix>, +which contains the entire set, and which is inherited by the modules for +other platforms. For further information, please see L<File::Spec::Mac>, L<File::Spec::OS2>, L<File::Spec::Win32>, or L<File::Spec::VMS>. =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 @@ -108,9 +86,7 @@ Kenneth Albanowski <F<kjahds@kjahds.com>>, Andy Dougherty <F<A.Koenig@franz.ww.TU-Berlin.DE>>, Tim Bunce <F<Tim.Bunce@ig.co.uk>>. VMS support by Charles Bailey <F<bailey@newman.upenn.edu>>. OS/2 support by Ilya Zakharevich <F<ilya@math.ohio-state.edu>>. Mac support by Paul Schinder -<F<schinder@pobox.com>>. - -=cut - - -1; +<F<schinder@pobox.com>>. abs2rel() and rel2abs() written by +Shigio Yamaguchi <F<shigio@tamacom.com>>, modified by Barrie Slaymaker +<F<barries@slaysys.com>>. splitpath(), splitdir(), catpath() and catdir() +by Barrie Slaymaker. |