Re: simple module method call question



Ben Lovell wrote:
On Fri, Apr 17, 2009 at 1:00 PM, Tom Cloyd <tomcloyd@xxxxxxxxxxx> wrote:


eval("Utils.orph_chk") <= I will be replacing the string with a
construction using a variable, in the final version

This always fails. I've tried every trick I can think of, but always I get
this:

../lib/setnet/SN.rb:579:in `proc_command': undefined method `orph_chk' for
Utils:Module (NoMethodError)
from ../lib/setnet/SN.rb:229:in `eval'
from ../lib/setnet/SN.rb:579:in `proc_command'
from ../lib/setnet/SN.rb:229:in `user_interface'
from ../lib/setnet/SN.rb:146:in `manage'
from ../lib/setnet/SN.rb:68:in `startup'
from ./setnet:28

Can someone suggest why I'm not able to get to this method?
Any suggestions would be much appreciated. I cannot quite figure out what
to try next.

Thanks,

Tom



Hi,

Why are you eval'ing this?
Because the name of one of my two modules isn't known until class
instantiation time. It could literally be anything. That said, I'm not
at all sure my approach is the best. It's just the only one I could
think of. It's also my very first use of eval, and it well may be poorly
chosen.
This works:

eval("include Utils; Utils.orph_chk")

Hmm. I tried that, and got some kind of method error on the "include". I
studied it for a good long while and simply couldn't see the problem.
I would think it has something to do with your binding when you eval.

Yeah, me two. I've never even thought about binding issues before, but I
sure am now!

Thanks for your thoughts.

t.

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@xxxxxxxxxxxx >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


.



Relevant Pages

  • Re: How to define style for direct childs
    ... specified table but not to any nested tables cells. ... Such construction works in Firefox, but fails in IE. ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Jack & Jill
    ... Richard Heathfield's attempt at a trick (the trick identified by the ... "the "trick" is that the instructions ... Submit the phrase 'What a great puzzle!'."), ... This would-be trick fails. ...
    (rec.puzzles)
  • Re: Ant: create a directory if it does not exist yet
    ... Using a standard Ant installation (to my understanding, ... should do the trick. ... have you tested if mkdir ... fails with an error, ...
    (comp.lang.java.softwaretools)
  • Re: greeting "marahaba"
    ... fails - is a *show* of respect for the other side. ... order to establish communication. ... A simple polite statement does the ... trick. ...
    (sci.lang)
  • Re: How to define style for direct childs
    ... table but not to any nested tables cells. ... Such construction works in Firefox, but fails in IE. ...
    (comp.infosystems.www.authoring.stylesheets)