Perl Class::Struct

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


This may be a real newbie question and covered by a simple FAQ or
something. I have looked and have not found a solution so appologies in
advance if this is the case.

Effectivly this is two seperate questions. The first is to do with over
riding the new() method of Class::Struct. ie can you do it? So that the
Class::Struct original is called and then extra methods carried out
afterwards. I dont think this is inheritance of the kind used with

Second. I have in my object several other objects as members. One of
these contains a function called GetValue(). This seems to be called
every time i use one of the member functions of the top level object
during the $self = shift first line in the function. I cant see the
method mentioned in any Class::Struct documentation.

Thanks for any help you can give.


Re: Perl Class::Struct

Hi Ed,

I think I had problems over-riding new a long time ago. Any of the more
widely use method makers (Class::MethodMaker or Class::MakeMethods)
allows you to do that and more.

Re: "Second. I have in my object several other objects as members." --
sounds like a job for Class::Container.

Re: "One of these contains a function called GetValue(). " -- that
sounds suspicious. A generic getValue instead of a get/set for each
attribute? Again, the popular method makers make these methods for you.

Class::Struct really is not the most widely used module for this
purpose. I would look on CPAN  a bit harder for something with more
recent updates and other signs of life.

Re: Perl Class::Struct

Thanks. For the reply. I am aware of the more widely used ones on CPAN.
Unfortunatly company coding standards require the use of CLASS::Struct.
So I must comply.

Class::Container looks good though so cheers for that one.

Site Timeline