summaryrefslogtreecommitdiff
path: root/ext/IO
diff options
context:
space:
mode:
authorChris Nandor <pudge@pobox.com>2001-06-11 04:24:28 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-11 12:13:31 +0000
commit6c254d95443e15da5c7456d8ce7c28f915ae00bb (patch)
tree46417fadc73894162a84d8130f83ba22c98d0bc3 /ext/IO
parent771df0940fe18ac10a1fb9f22390e99d0aa14d65 (diff)
downloadperl-6c254d95443e15da5c7456d8ce7c28f915ae00bb.tar.gz
[RESEND] [PATCH] Mac OS lib patches for bleadperl
Message-Id: <p05100303b74a66faf625@[10.0.1.177]> p4raw-id: //depot/perl@10511
Diffstat (limited to 'ext/IO')
-rw-r--r--ext/IO/lib/IO/Dir.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/IO/lib/IO/Dir.pm b/ext/IO/lib/IO/Dir.pm
index 1fa07ed6b8..a2e3b5ef7f 100644
--- a/ext/IO/lib/IO/Dir.pm
+++ b/ext/IO/lib/IO/Dir.pm
@@ -6,7 +6,7 @@
package IO::Dir;
-use 5.003_26;
+use 5.6.0;
use strict;
use Carp;
@@ -16,6 +16,7 @@ use IO::File;
our(@ISA, $VERSION, @EXPORT_OK);
use Tie::Hash;
use File::stat;
+use File::Spec;
@ISA = qw(Tie::Hash Exporter);
$VERSION = "1.03";
@@ -44,6 +45,9 @@ sub open {
my ($dh, $dirname) = @_;
return undef
unless opendir($dh, $dirname);
+ # a dir name should always have a ":" in it; assume dirname is
+ # in current directory
+ $dirname = ':' . $dirname if ( ($^O eq 'MacOS') && ($dirname !~ /:/) );
${*$dh}{io_dir_path} = $dirname;
1;
}
@@ -103,18 +107,18 @@ sub NEXTKEY {
sub EXISTS {
my($dh,$key) = @_;
- -e ${*$dh}{io_dir_path} . "/" . $key;
+ -e File::Spec->catfile(${*$dh}{io_dir_path}, $key);
}
sub FETCH {
my($dh,$key) = @_;
- &lstat(${*$dh}{io_dir_path} . "/" . $key);
+ &lstat(File::Spec->catfile(${*$dh}{io_dir_path}, $key));
}
sub STORE {
my($dh,$key,$data) = @_;
my($atime,$mtime) = ref($data) ? @$data : ($data,$data);
- my $file = ${*$dh}{io_dir_path} . "/" . $key;
+ my $file = File::Spec->catfile(${*$dh}{io_dir_path}, $key);
unless(-e $file) {
my $io = IO::File->new($file,O_CREAT | O_RDWR);
$io->close if $io;
@@ -125,7 +129,7 @@ sub STORE {
sub DELETE {
my($dh,$key) = @_;
# Only unlink if unlink-ing is enabled
- my $file = ${*$dh}{io_dir_path} . "/" . $key;
+ my $file = File::Spec->catfile(${*$dh}{io_dir_path}, $key);
return 0
unless ${*$dh}{io_dir_unlink};