At 15:21 +0100 2003.01.09, Bart Lateur wrote:
>On Thu, 09 Jan 2003 03:59:10 -0800, SourceForge.net wrote:
>
>>The following failes:
>
>>$fh->open( '$file', "r" ) or die "unable to open'$file' - $!";
>>
>>Note the leading space in the hard disk name " myharddisk".
>
>Also note the single quotes around $file in the method call. Could that
>be it, or is this a case of badly typed over code?

I noted in the bug report that IO::File->open uses either sysopen for
numeric modes, or two-arg open.  There is no way, that I know of, to open a
path that has leading space, period, with two-arg open.  If the path is
relative, you can protect it with "./", but that is not possible here.

I -- or someone who wants to -- needs to patch IO::File to use three-arg
open.  It'd be pretty easy, but will require testing, of course.  Something
like (untested)


         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";
+        return open($fh, IO::Handle::_open_mode_string($mode), $file);
     }
     open($fh, $file);

Would just need to make sure this doesn't break anything (including
pre-perl 5.6, if IO still works there).

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to