summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>1999-03-01 01:32:05 +0100
committerGurusamy Sarathy <gsar@cpan.org>1999-02-28 23:55:08 +0000
commit5c6095350fa4ff9d9ad1727b7c75dfb18822ef5a (patch)
tree6757db66b26b23c99d63caff61216e8be5dc0d0a /lib
parent0a00efa027f840c152623bd38c5da7c93b24c3e1 (diff)
downloadperl-5c6095350fa4ff9d9ad1727b7c75dfb18822ef5a.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/File/Spec.pm31
-rw-r--r--lib/File/Spec/Functions.pm83
2 files changed, 102 insertions, 12 deletions
diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm
index 9de9a8036f..b71e357cdc 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;>
+ use File::Spec;
-C<$x=File::Spec-E<gt>catfile('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<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
diff --git a/lib/File/Spec/Functions.pm b/lib/File/Spec/Functions.pm
new file mode 100644
index 0000000000..77561abf09
--- /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<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>.
+
+=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