=item new ( FILENAME [,MODE [,PERMS]] )
-Creates a C<IO::File>. If it receives any parameters, they are passed to
+Creates an C<IO::File>. If it receives any parameters, they are passed to
the method C<open>; if the open fails, the object is destroyed. Otherwise,
it is returned to the caller.
the open mode, optionally followed by a file permission value.
If C<IO::File::open> receives a Perl mode string ("E<gt>", "+E<lt>", etc.)
-or a ANSI C fopen() mode string ("w", "r+", etc.), it uses the basic
+or an ANSI C fopen() mode string ("w", "r+", etc.), it uses the basic
Perl C<open> operator (but protects any special characters).
If C<IO::File::open> is given a numeric mode, it passes that mode
defined $perms or $perms = 0666;
return sysopen($fh, $file, $mode, $perms);
}
- if (! File::Spec->file_name_is_absolute($file)) {
- $file = File::Spec->catfile(File::Spec->curdir(),$file);
- }
+ if (defined($file) && length($file)
+ && ! 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);