I was experimenting with some code, jogging my memory of linked lists. The approach I took was to define a package LinkedListNode and then a package LinkedList. My idea is that my LinkedList package is a wrapper around the head node which would also define some useful methods such as print_list(), remove_node(), and so forth.
I did this by having the constructor for LinkedList create and bless() the head node. But then I ran into a problem having this object call LinkedListNode methods. This was solved by making LinkedList a subclass of LinkedListNode with the line unshift @ISA, 'LinkedListNode'; Ok, so I am doing what seems to me to be "composition" in OO speak. That was my design intention anyway. The only way I've found that it works is to use a parent class relationship. Does Perl have some other way of doing this, using the built in OO system? I've read http://search.cpan.org/~rjbs/perl-5.18.4/pod/perlootut.pod#Composition and it seems that the answer is "No, what I've done is the way to do it." but I thought I'd ask in case I'm just not getting something? I only want to use the Perl built in OO system. I am aware Moose (and others) have facilities for this. My code is at http://pastebin.com/8fnxY0Xy if you'd like to take a look. Any other questions or comments on this code would be appreciated as well. I've been brushing up on a few things and am open to comments. Thanks! Adam _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

