Jeff 'japhy' Pinyan wrote:
On Jul 13, JupiterHost.Net said:
In a script I can access __END__ via <DATA>
I'd like to access __END__ form within a module (IE package)
Reading 'perldoc perldata' yields this:
Text after __DATA__ but may be read via the filehandle "PACK-
NAME::DATA", where "PACKNAME" 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
"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 toplevel script (but not in files loaded with
"require" or "do") and leaves the remaining contents of the file acces-
sible via "main::DATA".
Thus, use __DATA__ in your modules, instead of __END__, and then you can
access the contents thereof by reading from <PackageName::DATA>.
Right on Jeff, thanks for pointing that out :)
Should of looked at the docs better :)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>