summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkeenan <jkeenan@cpan.org>2012-02-27 12:34:10 -0500
committerRicardo Signes <rjbs@cpan.org>2012-02-28 21:00:17 -0500
commit4d383607e45d2ed8b044662e85b1f5e1d8825d77 (patch)
tree37b07d2caf9aab1c9eb7f31c9aa7292abe2787cf
parente50af245705329617325f329ad3250122ecbf59a (diff)
downloadperl-4d383607e45d2ed8b044662e85b1f5e1d8825d77.tar.gz
Explain why program must close __DATA__ handle.
Adapted from suggestion by David Golden++. For RT #37033.
-rw-r--r--pod/perldata.pod13
1 files changed, 7 insertions, 6 deletions
diff --git a/pod/perldata.pod b/pod/perldata.pod
index 16ceb41048..4322af9013 100644
--- a/pod/perldata.pod
+++ b/pod/perldata.pod
@@ -416,12 +416,13 @@ end of file. Any following text is ignored.
Text after __DATA__ may be read via the filehandle C<PACKNAME::DATA>,
where C<PACKNAME> is the package that was current when the __DATA__
token was encountered. The filehandle is left open pointing to the
-line after __DATA__. It is the program's responsibility to
-C<close DATA> when it is done reading from it. For compatibility with
-older scripts written before __DATA__ was introduced, __END__ behaves
-like __DATA__ in the top level script (but not in files loaded with
-C<require> or C<do>) and leaves the remaining contents of the
-file accessible via C<main::DATA>.
+line after __DATA__. The program should C<close DATA> when it is done
+reading from it. (Leaving it open leaks filehandles if the module is
+reloaded for any reason, so it's a safer practice to close it.) For
+compatibility with older scripts written before __DATA__ was
+introduced, __END__ behaves like __DATA__ in the top level script (but
+not in files loaded with C<require> or C<do>) and leaves the remaining
+contents of the file accessible via C<main::DATA>.
See L<SelfLoader> for more description of __DATA__, and
an example of its use. Note that you cannot read from the DATA