in reply to Re: Perl semi-object without a constructor
in thread Perl semi-object without a constructor
"Why do you think $conn has no methods? "
Because of my ignorance of the nuances of Perl classes and objects. All of the texts I looked at started with a package and a sub called 'new' to create the object. I had been looking at Msg.pm as a way to carve out and localize a set of functions and have a cleaner organization. That is the only usage I knew about for packages.
Because of my ignorance of the nuances of Perl classes and objects. All of the texts I looked at started with a package and a sub called 'new' to create the object. I had been looking at Msg.pm as a way to carve out and localize a set of functions and have a cleaner organization. That is the only usage I knew about for packages.
This exploration has been enlightening, and gives me a new light to look at Perl packages. The simple explanation of:
The first argument is the string "Msg" - that is, the part before the ->. This is how method calls work in Perl (we borrowed it from Python); the thing before the arrow gets passed in as the first argument.Is the key that I never found in my frantic scanning of my library; I didn't find an explanation of the mechanics, just the conceptualization of OO.
Thanks a bunch! odd, ending my text with an exclamation point messes up formatting.
!-- Node text goes above. Div tags should contain sig only -->It is always better to have seen your target for yourself, rather than depend upon someone else's description.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Perl semi-object without a constructor
by tobyink (Canon) on Feb 21, 2013 at 17:37 UTC |
In Section
Seekers of Perl Wisdom