Morton Goldberg
8/3/2007 2:07:00 AM
On Aug 2, 2007, at 1:32 PM, dblack@rubypal.com wrote:
> Can you produce a complete working example? I'm having trouble
> getting it not to not work.... Here's what I'm doing so far:
>
> a = 1
>
> def x
> eval(DATA.read, binding)
> end
>
> x # error: a undefined
>
> __END__
> puts a
>
>
> Is that analogous to what's in the original?
I'm kind of late to this party, but is it relevant that each of the
following works?
<code>
a = 1
def x
eval(DATA.read, TOPLEVEL_BINDING)
end
x
__END__
puts a
</code>
<code>
def x(a)
eval(DATA.read, binding)
end
x(42)
__END__
puts a
</code>
Regards, Morton