From: Yusuke Endoh Date: 2012-02-14T21:37:45+09:00 Subject: [ruby-core:42619] [ruby-trunk - Feature #1591][Rejected] DATA handle unusable in required modules Issue #1591 has been updated by Yusuke Endoh. Status changed from Assigned to Rejected I'm rejecting this feature ticket because no progress has been made for a long time. See [ruby-core:42391]. This feature is difficult to implement in terms of resource of file descriptor. The interpreter must keep the descriptor of each source file that ends with __END__ because the content may be accessed. This leads to a shortage of file descriptor. AFAIK, DATA and __END__ came from Perl. The behavior of Ruby is also the same as Perl's. -- Yusuke Endoh ---------------------------------------- Feature #1591: DATA handle unusable in required modules https://bugs.ruby-lang.org/issues/1591 Author: Chris Davaz Status: Rejected Priority: Normal Assignee: Yukihiro Matsumoto Category: Target version: ruby -v: ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux] =begin I have a Module defined in a file that gets required by a script. Inside the module I set a class variable: module MyModule class MyClass @@data = DATA.readlines def MyClass.getData return @@data end # ... end end __END__ lots of words ... DATA is undefined! If I add an __END__ section to the script that requires my module, DATA becomes defined and it contains the data in the script. Obviously the way this works makes DATA + __END__ useless except for the one case where a person wants to access __END__ data from within their own script. I would think the more common case would be a module requires a bunch of data and it is convenient to just put that at the end of the file that contains the module and load it up when it gets required. =end -- http://bugs.ruby-lang.org/