> [stmpeters - Sat Nov 27 07:36:47 2004]: > > > [ni-s - Thu Sep 30 14:34:10 2004]: > > > > Steve Peters via RT <perlbug-followup@perl.org> writes: > > > > > >Two points brought up remain, though. > > > > > >* Do we want to add an optional argument to IO::File->new() so that it > > >fails on an open attempt on a directory? The advantage of this would > > >be that it would allow for consistant cross-platform behavior. This > > >would add some overhead to IO::File (likely a -d) to the constructor > > >for IO::File. > > > > > > > >* Do we want to document this behavior? Those who have bounced around > > >several POSIX environments have experienced this before and have > > >learned to deal with this behavior. Does this deserve mention on > > >IO::File's Pod, or is a FAQ entry sufficient? > > > > Personally I see no reason to use IO::File ever again so I don't care > > what you do to it, or its POD. > > > > I see some minor merit in mentioning amongst all the other > > perldoc -f open stuff. > > As for a FAQ entry, I don't remember this coming up > > before and I have been on p5p for (9?!) years so this isn't > > a very 'F' 'AQ'! > > > > Below is a patch to explain the behavior and to suggest better alternatives. > > --- /usr/libdata/perl5/i386-openbsd/5.8.5/IO/File.pm Fri Sep 17 > 13:09:59 2004 > +++ ./IO/File.pm Sat Nov 27 09:32:46 2004 > @@ -95,12 +95,20 @@ > > =back > > +=head1 NOTE > + > +Some operating systems may allow a C<IO::File::new> or C<IO::File::open> > +to be performed on a directory without errors. This behavior is not > +portable and not suggested for use. Instead, C<opendir> and C<readdir> or > +C<DirHandle> suggested instead. > + ... Scratch the previous patch as I noticed a grammatical error right after sending it off. Use the below patch instead. --- /usr/libdata/perl5/i386-openbsd/5.8.5/IO/File.pm Fri Sep 17 13:09:59 2004 +++ ./IO/File.pm Sat Nov 27 09:38:21 2004 @@ -95,12 +95,20 @@ =back +=head1 NOTE + +Some operating systems may allow a C<IO::File::new> or C<IO::File::open> +to be performed on a directory without errors. This behavior is not +portable and not suggested for use. Instead, C<opendir> and C<readdir> or +C<DirHandle> are suggested instead. + =head1 SEE ALSO L<perlfunc>, L<perlop/"I/O Operators">, L<IO::Handle> L<IO::Seekable> +L<DirHandle> =head1 HISTORY @@ -121,7 +129,7 @@ @ISA = qw(IO::Handle IO::Seekable Exporter); -$VERSION = "1.10"; +$VERSION = "1.11"; @EXPORT = @IO::Seekable::EXPORT;