This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
portability fix for IO::File and FileHandle
authorPeter Prymmer <PPrymmer@factset.com>
Fri, 11 Jun 1999 17:07:19 +0000 (10:07 -0700)
committerGurusamy Sarathy <gsar@cpan.org>
Tue, 6 Jul 1999 09:51:20 +0000 (09:51 +0000)
Message-Id: <9906120007.AA13802@forte.com>

p4raw-id: //depot/perl@3611

ext/IO/lib/IO/File.pm

index fa7e804..47f43d1 100644 (file)
@@ -110,6 +110,7 @@ use Carp;
 use Symbol;
 use SelectSaver;
 use IO::Seekable;
+use File::Spec;
 
 require Exporter;
 require DynaLoader;
@@ -158,7 +159,9 @@ sub open {
            defined $perms or $perms = 0666;
            return sysopen($fh, $file, $mode, $perms);
        }
-       $file = './' . $file if $file =~ m{\A[^\\/\w]};
+       if (! File::Spec->file_name_is_absolute($file)) {
+            $file = File::Spec->catfile(File::Spec->curdir(),$file);
+        }
        $file = IO::Handle::_open_mode_string($mode) . " $file\0";
     }
     open($fh, $file);