diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-07 06:41:13 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-07 06:41:13 +0000 |
commit | af8c498a3c5921fd79e24d6a33b8c04cc35f453b (patch) | |
tree | dd5f1e19ef871d47b9e9a1c89dc463de3ff19eb9 /pod | |
parent | b522bf068e1d0db0c7adc5726238584c2aaf623d (diff) | |
download | perl-af8c498a3c5921fd79e24d6a33b8c04cc35f453b.tar.gz |
better diagnostics on read operations from write-only
filehandles
p4raw-id: //depot/perl@3632
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldelta.pod | 21 | ||||
-rw-r--r-- | pod/perldiag.pod | 12 |
2 files changed, 24 insertions, 9 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 3284cf70da..be5366d116 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -229,6 +229,13 @@ was attempted. This mostly eliminates confusing buffering mishaps suffered by users unaware of how Perl internally handles I/O. +=head2 Better diagnostics on meaningless filehandle operations + +Constructs such as C<open(E<lt>FHE<gt>)> and C<close(E<lt>FHE<gt>)> +are compile time errors. Attempting to read from filehandles that +were opened only for writing will now produce warnings (just as +writing to read-only filehandles does). + =head1 Supported Platforms =over 4 @@ -467,16 +474,24 @@ A tutorial on managing class data for object modules. by Perl. This combination appears in an interpolated variable or a C<'>-delimited regular expression. -=item Unrecognized escape \\%c passed through +=item Filehandle %s opened only for output -(W) You used a backslash-character combination which is not recognized -by Perl. +(W) You tried to read from a filehandle opened only for writing. If you +intended it to be a read-write filehandle, you needed to open it with +"+E<lt>" or "+E<gt>" or "+E<gt>E<gt>" instead of with "E<lt>" or nothing. If +you intended only to read from the file, use "E<lt>". See +L<perlfunc/open>. =item Missing command in piped open (W) You used the C<open(FH, "| command")> or C<open(FH, "command |")> construction, but the command was missing or blank. +=item Unrecognized escape \\%c passed through + +(W) You used a backslash-character combination which is not recognized +by Perl. + =item defined(@array) is deprecated (D) defined() is not usually useful on arrays because it checks for an diff --git a/pod/perldiag.pod b/pod/perldiag.pod index d7b9024998..45c7be1905 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1265,7 +1265,7 @@ PDP-11 or something? You need to do an open() or a socket() call, or call a constructor from the FileHandle package. -=item Filehandle %s opened for only input +=item Filehandle %s opened only for input (W) You tried to write on a read-only filehandle. If you intended it to be a read-write filehandle, you needed to open it with @@ -1273,12 +1273,12 @@ intended it to be a read-write filehandle, you needed to open it with you intended only to write the file, use "E<gt>" or "E<gt>E<gt>". See L<perlfunc/open>. -=item Filehandle opened for only input +=item Filehandle %s opened only for output -(W) You tried to write on a read-only filehandle. If you +(W) You tried to read from a filehandle opened only for writing. If you intended it to be a read-write filehandle, you needed to open it with "+E<lt>" or "+E<gt>" or "+E<gt>E<gt>" instead of with "E<lt>" or nothing. If -you intended only to write the file, use "E<gt>" or "E<gt>E<gt>". See +you intended only to read from the file, use "E<lt>". See L<perlfunc/open>. =item Final $ should be \$ or $name @@ -2274,7 +2274,7 @@ are outside the range which can be represented by integers internally. One possible workaround is to force Perl to use magical string increment by prepending "0" to your numbers. -=item Read on closed filehandle E<lt>%sE<gt> +=item Read on closed filehandle %s (W) The filehandle you're reading from got itself closed sometime before now. Check your logic flow. @@ -3169,7 +3169,7 @@ but in actual fact, you got So put in parentheses to say what you really mean. -=item Write on closed filehandle +=item Write on closed filehandle %s (W) The filehandle you're writing to got itself closed sometime before now. Check your logic flow. |