package C::C1; # That's the perlish name for the module
use File::FindLib 'lib';
use A;
use B;
use C;
use D;
sub new {
return bless({
_a => A->new->bar, # I don't understand bar here
_b => B->new->bar1, # nor bar1 here
_c => C->new(),
_d => D->new(),
}, shift);
}
# now for any method of A:
sub a_method_1 {
my $self = shift;
$self->_a->a_method 1(@_);
}
# etc
# And for any method of B:
sub b_method_1 {
my $self = shift;
$self->_a->b_method 1(@_);
}
# etc
# Repeat for C and D, ad libidum.
####
sub new_d {
my $self = shift;
if (@_) {
$self->{_d} = D->new(@_);
}
return $self->{_d};
}
##
##
use C::C1;
my $c1 = C::C1->new;
$c1->a_method_1(); # will execute A::a_method_1
$c1->b_method_1(); # will execute B::b_method_1
$c1->new_d(@params) # will execute $self->{_d} = D->new(@params)