Date: Sat, 06 Mar 1999 17:50:49 +0100
Message-ID: <
36e25209.33833760@smtp1.ibm.net>
Subject: [PATCH 5.005_56] Fixes for File::Spec::Functions.pm
--
Date: Sat, 06 Mar 1999 18:15:00 +0100
Message-ID: <
36e36222.37954195@smtp1.ibm.net>
Subject: [PATCH 5.005_56] Fix for File::Spec::Win32.pm
p4raw-id: //depot/perl@3132
t/lib/filecache.t See if FileCache works
t/lib/filecopy.t See if File::Copy works
t/lib/filefind.t See if File::Find works
+t/lib/filefunc.t See if File::Spec::Functions works
t/lib/filehand.t See if FileHandle works
t/lib/filepath.t See if File::Path works
t/lib/filespec.t See if File::Spec works
use File::Spec;
use strict;
-use vars qw(@ISA @EXPORT);
+use vars qw(@ISA @EXPORT @EXPORT_OK);
require Exporter;
catdir
catfile
curdir
- devnull
rootdir
- tmpdir
updir
no_upwards
file_name_is_absolute
path
+);
+
+@EXPORT_OK = qw(
+ devnull
+ tmpdir
splitpath
splitdir
catpath
rel2abs
);
-foreach my $meth (@EXPORT) {
+foreach my $meth (@EXPORT, @EXPORT_OK) {
+ my $sub = File::Spec->can($meth);
no strict 'refs';
- *{$meth} = File::Spec->can($meth);
+ *{$meth} = sub {&$sub('File::Spec', @_)};
}
catdir
catfile
curdir
- devnull
rootdir
- tmpdir
updir
no_upwards
file_name_is_absolute
path
+
+
+The following functions are exported only by request.
+
+ devnull
+ tmpdir
splitpath
splitdir
catpath
my ($self,$path,$reduce_ricochet) = @_;
$path =~ s/^([a-z]:)/\u$1/;
$path =~ s|/|\\|g;
- $path =~ s|([^\\])\\+|\1\\|g; # xx////xx -> xx/xx
+ $path =~ s|([^\\])\\+|$1\\|g; # xx////xx -> xx/xx
$path =~ s|(\\\.)+\\|\\|g; # xx/././xx -> xx/xx
$path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx
$path =~ s|\\$||
New features: "each for at least N CPU seconds...", "wallclock secs",
and the "@ operations/CPU second (n=operations)".
+=item Devel::Peek
+
+The Devel::Peek module provides access to the internal representation
+of Perl variables. It is a data debugging tool for the XS programmer.
+
=item Fcntl
More Fcntl constants added: F_SETLK64, F_SETLKW64, O_LARGEFILE for
locking behaviour flags F_FLOCK, F_POSIX, Linux F_SHLCK, and
O_ACCMODE: the mask of O_RDONLY, O_WRONLY, and O_RDWR.
+=item File::Spec
+
+New methods have been added to the File::Spec module: devnull() returns
+the name of the null device (/dev/null on UNIX) and tmpdir() the name of
+the temp directory (normally /tmp on UNIX). There are now also methods
+to convert between absolute and relative filenames: abs2rel() and
+rel2abs(). For compatibility with operating systems that specify volume
+names in file paths, the splitpath(), splitdir() and catdir() methods
+have been added.
+
+=item File::Spec::Functions
+
+The new File::Spec::Functions modules provides a function interface
+to the File::Spec module. Allows shorthand
+
+ $fullname = catfile($dir1, $dir2, $file);
+
+instead of
+
+ $fullname = File::Spec->catfile($dir1, $dir2, $file);
+
=item Math::Complex
The accessor methods Re, Im, arg, abs, rho, and theta, can now also
access to Berkeley DB
+=item Devel::Peek
+
+data debugging tool for the XS programmer
+
=item Devel::SelfStubber
generate stubs for a SelfLoading module
create or remove a series of directories
+=item File::Spec
+
+portably perform operations on file names
+
+=item File::Spec::Functions
+
+function call interface to File::Spec module
+
=item File::stat
by-name interface to Perl's builtin stat() functions
--- /dev/null
+#!./perl
+
+BEGIN {
+ $^O = '';
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+}
+
+print "1..1\n";
+
+use File::Spec::Functions;
+
+if (catfile('a','b','c') eq 'a/b/c') {
+ print "ok 1\n";
+} else {
+ print "not ok 1\n";
+}