On Feb 17, 2004, at 8:33 PM, R. Joseph Newton wrote:
Andrew Gaffney wrote:
This is what I didn't quite understand. I didn't realize that Perl's "black magic" allowed the blessed reference to refer back to the object already in memory. In effect, the blessed reference carries around the entire class object with it.
Not quite. The beauty of references is that you don't have to lug the whole object around. The reference is more like a map that shows where to very quickly find the object. So what you carry around evcerywhere is access to the object, not the object itself.
A good way of stating that.
On top of the usual perdoc referrences that I think Wiggin's has pointed, the traditional documentation that explains most of what is going on with modules and references, specifically blessed references, it would probably do Andrew some good to get a feel for what 'compilers' have to do to take a text file and turn it into an 'executable bit stream', whether we are talking 'traditional compilers' or 'runtime compilers' like perl.
In the dark, to a compiler, everything is a symbol, it is either going to be translated into a reference to a memory slot that one peeks and/or pokes to 'stash' dynamic data - or it is a reference to some 'block of code stuff' that will need to be deconstructed down to 'machine language' that can be easily loaded into the CPU for it to much 'one instruction at a time'.
Depending upon how one implements an 'object' - it is either the case that one has to load all of the 'methods' dynamically for each instance of an object. OR one implements the compiler to load one instance of the methods, and implements a dispatching table associated with an 'instance' of the object that knows how to find the 'methods'.
The real challenge when 'containing' another module inside of one's own module, is how much you will 'expose' about the, in this case DBI, to the users of one's module. Some people go completely BONKERS having to crawl up the inheritence chain of documentation to understand what methods can really be used on a sub_sub_sub_sub_class... So make sure that your documentation makes clear where to find all of the other docs...
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>