the_Don has asked for the wisdom of the Perl Monks concerning the following question:
At work there is this entire testing system that is written in Perl and I am not exactly clear on how/what it does.. so if this question does not appear to be a Perl issue, it could very well be something to do with the testing system. Having said that, here is my question:
I have a series of functions that are called, and inside each of these functions an object is created from a common class. I use a reference to that object only inside the function where it is created.
When each of the functions are executed, the first one runs without any warnings, while all subsequent creations using the same class results in warnings about functions being re-defined.
And that is ok, I guess, since each creation of the object calls a series of eval statements that create a set of functions for setting and getting object values. But then again its not ok to me because I am confused as to why the pre-existing evals are still remembered. I thought that the evals were specific to that objects methods and when each function exited, the object as well as its dynamically created functions would be lost. Obviously this is not the case since the solution to this problem was to have a use statement that passed values to Class:MethodMaker.
But this now brings me to my question. What happened inside Perl that made the evals for the one object create entries for the entire namespace of that class? How does Perl handle evals that dynamically create functions, i.e. what are the steps that are taken to implement that. Or, where is there an existing explanation into the relative working parts of Perl?
Thank you for your attention and I understand if this explanation is lacking. Please feel free to ask me to clarify.
the_Don
...making offers others can't rufuse.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Redefined Methods.. ok, Why?
by perrin (Chancellor) on Feb 03, 2003 at 19:52 UTC | |
|
Re: Redefined Methods.. ok, Why?
by dragonchild (Archbishop) on Feb 03, 2003 at 20:36 UTC |