note that this seems to have been fixed in perl 5.8.0, so read this only if you have not upgraded (yet)!
the bug appears when you use warnings and close STDERR (which is not a meaningful thing to do, but nonetheless...) and it causes the readline operator (eg. <STDIN>) to only read the first line of a file.
| OS | Perl build | Buggy |
| Windows 2000 Pro, XP Pro | v5.6.0 built for MSWin32-x86-multi-thread | YES |
| Windows 2000 Pro, XP Pro | v5.6.1 built for MSWin32-x86-multi-thread | YES |
| Windows 2000 Pro, XP Pro | v5.6.1 built for cygwin-multi | NO |
| Windows 2000 Pro | v5.8.0 built for MSWin32-x86-multi-thread | NO |
| Red Hat Linux release 7.0 (Guinness) | v5.6.0 built for i386-linux | NO |
| Red Hat Linux release 7.0 (Guinness) | v5.8.0 built for i586-linux-thread-multi-ld | NO |
summing this up, the bug seems to show only on Win32 with Perl 5.6.0 and 5.6.1 (but not with Cygwin).
if you run it as it is, it will read (and thus print) only the first line of the file.use warnings; close(STDERR); open(ME, "$0"); while (<ME>) { print; } close ME;
if you comment either the first line (use warnings) or the second line (close(STDERR)), the whole file is printed fine.
cheers,
Aldo
King of Laziness, Wizard of Impatience, Lord of Hubris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: warning: perl bug in 5.6.x, Win32 (use warnings and STDERR)
by crazyinsomniac (Prior) on Mar 21, 2003 at 11:28 UTC | |
by Jenda (Abbot) on Mar 21, 2003 at 13:42 UTC | |
|
Re: warning: perl bug in 5.6.x, Win32 (use warnings and STDERR)
by Mr. Muskrat (Canon) on Mar 21, 2003 at 17:33 UTC |