Hi and thanks Sutton, > Igor Sutton wrote: > Hi Mug, > > package PackA; > > sub new { > my ($class) = @_; > my $self = {}; > bless $self, $class; > my $self->{B} = PackB->new($self); > return $self; > } > > package PackB; > > sub new { > my ($class, $packA_ref) = @_; > my $self = { > A => $packA_ref; > }; > bless $self, $class; > return $self; > } That's a very great approach to make them know each other as early as by the construct level ! I don't need to worry about where I should create there link-up spot then.. I have made it through now ! thanks!
> > This way you avoid coupling between PackB and PackA. PackA is composed > by PackB, but PackB does not really needs PackA to exist. You can > safely subclass PackA to PackAA, for instance: > > package PackAA; > > use base qw(PackA); > > sub do_specific_thing { > my ($self) = @_; > my $data = $self->{B}->do_other_thing($self); # see, $self is PackAA > instead. > ... > } > That's even a more interesting way to split the package, but unfortunate that I can only try it next time. Yet already wrote too many uneasy bulky =( Thanks again ! Mug -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/