in reply to Access custom classes 'self' array

Did you read perlboot, perltoot, perltooc and perlbot? These perldoc files contain the basic knowledge of using objects in Perl.

Or use one of the object-constructing modules (my present favourite being Moose, but that my be overkill and Class::Dot or such may be sufficient).

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Access custom classes 'self' array
by true_atlantis (Acolyte) on Sep 11, 2007 at 06:42 UTC
    Yes, I have read all of those. This is just a basic example to show the idea of what im trying to do. My real world situation is a bit different. I have a set of classes that are inherited from a base 'Object' class. I can write one function in the 'Object' class that takes care of all the inherited classes, or write the function 20 times in each of the inherited classes... Do you see what I am saying?
      OK, in that case you really should have a look at Moose. Although it is a bit "heavy", it has a very clear structure and allows for all forms of inheritance with well constructed build and destroy mechanisms. You don't even have to write your own new routine as it is already provided for you!

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James