The following failes:
use IO::File;
my $file = ' myharddisk:folder:filename';
my $fh = IO::File->new;
$fh->open( '$file', "r" ) or die "unable to open'$file' - $!";
Note the leading space in the hard disk name " myharddisk".
Axel
Logged In: YES
user_id=3660
A bug in IO::File. It does this in open():
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);
For detail, see the documentation for open in perlfunc and
in IO::File for a discussion of protecting whitespace in a
path. Normally, open() removes leading and trailing
whitespace. The problem is that the only method they gave
for protecting leading whitespace, apart from using the
three-arg form of open(), is to put "./" or something in
front of the relative path. This assumes that whitespace
cannot be in front of an absolute path; as such, there's no
way (that I know of) to use the two-arg form with such a path.
I'll think on a patch; until then, the only workarounds are
to patch it yourself, rename the volume, use open() instead
of IO::File->open(), or use numeric modes, such as:
my $file = ' MyDisk:foo';
my $fh = IO::File->new;
$fh->open($file, O_RDONLY) or die "unable to open
'$file': $!";
The numeric modes in IO::File use sysopen(), which is not
magic like open() is.