more useful options | |
PerlMonks |
Re: Re: Re: Re: Re: Classes Are Killing Meby Anonymous Monk |
on May 20, 2002 at 03:34 UTC ( [id://167763]=note: print w/replies, xml ) | Need Help?? |
Post the code that lead you to believe that the
Cookbook was wrong, and I will try to get back to you
Monday evening with an explanation of why you got an
error if nobody else does first. Based on what I know, I find it very likely that your mistaken code was something like: which resulted in an error message like: Very confusing. So you you fiddled around with the code, somehow decided that you needed to use a global before eventually hitting on changing that line by adding Person:: to the method name, which hid the underlying problem. Your experiments probably were mostly variations on the theme of telling it that you want, "Person, not main you moron!" And by the time it finally listened, you had what you posted. BTW that was not meant as a flame. It describes a common programming trap. Something doesn't work like it is supposed to, blame is assigned early, and the person goes into a pattern of somewhat random experimentation until something (hopefully) works. This is a natural tendancy but is horrible for programming. You need to change one thing and only one thing at a time. And random changes are probably bad ones. In this case, when you tried to type in examples from the book and they didn't work, you should have looked closely for how your code didn't match, and if you couldn't see it then post showing your exact code, your error message, name the book and page you are trying to copy, and say, "I don't understand why this is giving me this error message, the book says it should work?" Then someone would have told you what your mistake was, and why your mistake resulted in that error. Just remember this for the future. If you find yourself doing random things to get something to work, you are trapped and need to back up, break down what is happening into small logical pieces, take a break, or get outside help. Random is bad.
In Section
Seekers of Perl Wisdom
|
|