From: Gurusamy Sarathy Date: Sun, 12 Sep 1999 22:06:25 +0000 (+0000) Subject: fix DATA leaks; reword documentation about the DATA filehandle X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3e92a2540996678c49663ee454dadc7970cdb925;p=p5sagit%2Fp5-mst-13.2.git fix DATA leaks; reword documentation about the DATA filehandle p4raw-id: //depot/perl@4131 --- diff --git a/ext/Opcode/Safe.pm b/ext/Opcode/Safe.pm index 2d09c2e..00ee85d 100644 --- a/ext/Opcode/Safe.pm +++ b/ext/Opcode/Safe.pm @@ -235,7 +235,7 @@ sub rdo { 1; -__DATA__ +__END__ =head1 NAME diff --git a/lib/Pod/Functions.pm b/lib/Pod/Functions.pm index 5e6551f..03cbf71 100644 --- a/lib/Pod/Functions.pm +++ b/lib/Pod/Functions.pm @@ -65,6 +65,8 @@ while () { } } +close DATA; + unless (caller) { foreach $type ( @Type_Order ) { $list = join(", ", sort @{$Kinds{$type}}); diff --git a/pod/perldata.pod b/pod/perldata.pod index f4c660d..067c6d9 100644 --- a/pod/perldata.pod +++ b/pod/perldata.pod @@ -327,15 +327,24 @@ The special literals __FILE__, __LINE__, and __PACKAGE__ represent the current filename, line number, and package name at that point in your program. They may be used only as separate tokens; they will not be interpolated into strings. If there is no current package -(due to an empty C directive), __PACKAGE__ is the undefined value. - -The tokens __END__ and __DATA__ may be used to indicate the logical -end of the script before the actual end of file. Any following -text is ignored, but may be read via a DATA filehandle: main::DATA -for __END__, or PACKNAME::DATA (where PACKNAME is the current -package) for __DATA__. The two control characters ^D and ^Z are -synonyms for __END__ in the main program, __DATA__ in a separate -module. See L for more description of __DATA__, and +(due to an empty C directive), __PACKAGE__ is the undefined +value. + +The two control characters ^D and ^Z, and the tokens __END__ and __DATA__ +may be used to indicate the logical end of the script before the actual +end of file. Any following text is ignored. + +Text after __DATA__ but may be read via the filehandle C, +where C is the package that was current when the __DATA__ +token was encountered. The filehandle is left open pointing to the +contents after __DATA__. It is the program's responsibility to +C when it is done reading from it. For compatibility with +older scripts written before __DATA__ was introduced, __END__ behaves +like __DATA__ in the toplevel script (but not in files loaded with +C or C) and leaves the remaining contents of the +file accessible via C. + +See L for more description of __DATA__, and an example of its use. Note that you cannot read from the DATA filehandle in a BEGIN block: the BEGIN block is executed as soon as it is seen (during compilation), at which point the corresponding