in reply to Help with objects.
I think you're getting confused about OO patterns. You must ask yourself: will TestClass be a ConfClass or it will have a ConfClass? After you answered that question, you will be able to implement it. If TestClass will BE a ConfClass:
package TestClass; use base qw(ConfClass); sub new { my $class = shift; my $self = $class->SUPER::new(); # Initialize the superclass ConfC +lass here. ... # Do whatever you want. return $self; }
If TestClass HAS a ConfClass object, then it should be someway like this:
package TestClass; use ConfClass; sub new { my $self = {}; bless $self; $self->conf(ConfClass->new()); } sub conf { my ($self, $conf) = @_; $self->{'_CONF'} = $conf if $conf; return $self->{'_CONF'}; }
Igor 'izut' Sutton
your code, your rules.
|
|---|