use Top; my $test = new Top (Foo=>'Start Foo'); use Top::Extend1; $test = plugin Top::Extend1 ($test, %settingsScopedToExtend1); use Top::Extend2; $test = plugin Top::Extend2 ($test, %settingsScopedToExtend2); #### sub plugin { my ($class, $other, %params) = @_; # # bless my new combined class # $other = bless $other, $class; # # set defaults scoped to Extend1 # $other->{"Extend1"}->{"someSetting"} = 'its value'; # # overwrite defaults # @{$other->{"Extend1"}}{keys %params} = values %params; # # update any $other data # $other->{'Foo'} .= ' Appended to it '; # # pass back our extended class # return $other; }