package Parent; use strict; use warnings; use Child; sub new { my $class = shift; my $this = {}; bless $this, $class; $this->setChild( Child->new( @_ ) ); return $this; } sub setChild { my ( $this, $child ) = @_; if ( defined $child ) { $this->{_child} = $child; return 1; } return undef; } sub getChild { my $this = shift; return $this->{_child}; } sub setChildValue1 { my ( $this, $value ) = @_; if ( defined $value ) { return $this->getChild()->setValue1( $value ); } return undef; } sub getChildValue1 { my $this = shift; return $this->getChild()->getValue1(); } sub setChildValue2 { my ( $this, $value ) = @_; if ( defined $value ) { return $this->getChild()->setValue2( $value ); } return undef; } sub getChildValue2 { my $this = shift; return $this->getChild()->getValue2(); } 1;