From: Neil Bowers Date: Mon, 12 May 1997 12:27:43 +0000 (+0100) Subject: Note that DATA filehandle is unavailable during BEGIN {} X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1d79a27f835368158fa27370bebb63728faf77b2;p=p5sagit%2Fp5-mst-13.2.git Note that DATA filehandle is unavailable during BEGIN {} Subject: DOC PATCH: restriction on DATA filehandle? This is a very minor patch to add in a clarification on the use of DATA within a BEGIN block. Thanks to Chip for confirming this. p5p-msgid: 199705121227.NAA29718@tardis.cre.canon.co.uk --- diff --git a/pod/perldata.pod b/pod/perldata.pod index 0dbb92a..e55f75a 100644 --- a/pod/perldata.pod +++ b/pod/perldata.pod @@ -296,7 +296,10 @@ 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__ (or __DATA__ in a module). See L for more description of -__DATA__, and an example of its use. +__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 +__DATA__ (or __END__) token hasn't been seen. A word that has no other interpretation in the grammar will be treated as if it were a quoted string. These are known as