Brian Candler <B.Candler / pobox.com> wrote in message news:<20030501083010.GA41857 / uk.tiscali.com>...
> I think it's because mod_ruby loads your code into an anonymous module, to
> protect the top-level namespace which is shared by all the mod_ruby
> applications running under the same interpreter. See
> 
> http://ruby-talk.org/65376
> http://ruby-talk.org/56532
> 

I got.  Thanks for a good advice.
I must use binding() in conclusion.

But how ERuby can do ERuby::import() ?
I think ERuby may calls eval in itself, but it has no need to
call binding().


view.rhtml
  .--------------------
  Hello <%= username %>!
  .--------------------

logic.rbx
  .--------------------
  require 'cgi'
  cgi = CGI.new
  print cgi.header
  
  require 'eruby'
  username = 'Ruby'
  ERuby::import('view.rhtml')	# no binding(), but evaled with no error.
  .--------------------

I have read ERuby source code (eruby_load() in eruby_lib.c),
but I could not get understand how ERuby do.

Would you teach me if you know it?

# Maybe, getting a binding() of anonymous package?

regards,
kwatch