Since I hate questions without answers and nodes without conclusions--here are my findings.
I was being an idiot. However, I think the manner in which I discovered this Simple Truth is worthwhile reading. First, the answer.
In the example code above, the correct syntax for calling the forwarded name method for the MyPackage::List object is as follows.
print $list->name; # NOT: print $list->items->name
Of course, this seems obvious with hindsight. It's a method of the $list object! I think I was trapped in a VB mindset and couldn't see the obvious Perlish use... or something.
Anyway, on to the important bit.
How I figured this out--aka How to 'Do The Work'
- I read the POD.
- I read the POD again.
- I looked at the module source*
- I used Super Search to look for "MethodMaker".
- I used Google to look for "MethodMaker".
- I spent a long time finding every pod2html mirror in existence.
- I got smart and Googled the comp.lang.perl groups.
That's when I found a nice thread about exploring the symbol table--and knew that was where I could find the name (hence, usage) of the
Class::MethodMaker method.
Dominus posted the
code I used.
Moreover, I found a wealth of other information. For instance, "-sugar" probably shouldn't be used... and a long list of reasons that I should use Class::MakeMethods instead.
Now, if I could only get Class::MakeMethods 1.006 to build under Win32... **sigh** ...back to work!
--
* The point in time that I scratched my head and called for backup.
May the Source be with you.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.