Front page | perl.perl5.porters |
Postings from November 2003
bug or a feature?
Thread Next
From:
Torsten Foertsch
Date:
November 7, 2003 11:35
Subject:
bug or a feature?
Message ID:
200311072032.52925.torsten.foertsch@gmx.net
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Is it a bug or a feature?
# perl -e 'open F, "/" and defined(scalar <F>) and print "ok\n"; print "$!\n"'
Is a directory
but
# perl -e 'undef $/;open F, "/" and defined(scalar <F>) and print "ok\n";
print "$!\n"'
ok
Is a directory
verified with 5.8.0 and 5.8.2 on Linux.
Under Linux read(2) returns EISDIR if the file descriptor refers to a
directory, i.e. it is an error.
perlop states:
In scalar context, evaluating a filehandle in angle brackĀ
ets yields the next line from that file (the newline, if
any, included), or "undef" at end-of-file or on error.
When $/ is set to "undef" (sometimes known as file-slurp
mode) and the file is empty, it returns '' the first time,
followed by "undef" subsequently.
I think C<< scalar <F> >> should return C<undef> even if not defined $/,
shouldn't it?
Torsten
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD4DBQE/q/NkwicyCTir8T4RAm2eAJdfyUWSmeDXMFjLquC4WjyLslJbAKCvK7V0
U3XRpe6UQx1H7RhuySVARA==
=nPn4
-----END PGP SIGNATURE-----
Thread Next
-
bug or a feature?
by Torsten Foertsch