S
Stefan Kaes
--------------050704080108030307000402
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
I tried to create local variables from a name=>value hash passed as a
parameter, but I can't get it to work. The following test program shows
what is happening:
def test1
eval "x=25"
eval 'print "x=#{x}\n"'
end
test1
def test2
eval "x=25"
print "x=#{x}\n"
end
test2
produces:
x=25
test.rb:189:in `test2': undefined local variable or method `x' for
main:Object ( NameError)
from test.rb:192
It seems that changes to local variables are not reflected back to the
executing environment.
Does anyone out there know how to solve this problem?
-- stefan
--------------050704080108030307000402--
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
I tried to create local variables from a name=>value hash passed as a
parameter, but I can't get it to work. The following test program shows
what is happening:
def test1
eval "x=25"
eval 'print "x=#{x}\n"'
end
test1
def test2
eval "x=25"
print "x=#{x}\n"
end
test2
produces:
x=25
test.rb:189:in `test2': undefined local variable or method `x' for
main:Object ( NameError)
from test.rb:192
It seems that changes to local variables are not reflected back to the
executing environment.
Does anyone out there know how to solve this problem?
-- stefan
--------------050704080108030307000402--