Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Using __DATA__ from a package

by Anonymous Monk
on Jun 18, 2013 at 04:01 UTC ( #1039506=note: print w/ replies, xml ) Need Help??


in reply to Re: Using __DATA__ from a package
in thread Using __DATA__ from a package

I'm not sure

 [perldoc://__DATA__] -> [href://http://perldoc.perl.org/functions/__DATA__.html|__DATA__] -> [doc://perldata]#[doc://perldata#Special-Literals] __DATA__ -> __DATA__ -> perldata#Special Literals

Text after __DATA__ may be read via the filehandle PACKNAME::DATA , where PACKNAME is the package that was current when the __DATA__ token was encountered. The filehandle is left open pointing to the line after __DATA__. The program should 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 require or do) and leaves the remaining contents of the file accessible via main::DATA .


Comment on Re^2: Using __DATA__ from a package
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039506]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2014-08-20 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (113 votes), past polls