|Don't ask to ask, just ask|
Overloading oddityby theguvnor (Chaplain)
|on Jan 27, 2004 at 21:41 UTC||Need Help??|
theguvnor has asked for the wisdom of the Perl Monks concerning the following question:
Today I found something interesting. I've used overloading in the past without trouble but today wasn't getting stringification to work. I reduced my problem to the following test case:
And here's my test script to use the class above:
The second print statement printed "Implicit: my name is " whereas the first print worked as desired, including the name.
I tested the above under both 5.8.0 Linux-multi-thread and 5.8.0 MSWin-multi-thread and eventually came to realize that I could get it to work by pointing my overload directive to a third function in SomeClass:
Any ideas why my first attempt failed? I can't see any good reason why my stringify() method works but not name(). Thanks in advance.