package Person; use Class::Trait 'LifeGuard'; use Class::Trait 'Dog' => { explicit => 'swim' }; Class::Trait->promise('doggie_treat'); Class::Trait->assemble; # this flattens the traits into this class sub AUTOLOAD { # we'll make &doggie_treat, if needed } 1; #### package Trait::LifeGuard; sub swim { return Trait::LifeGuard::_swim(); } sub save_drowning_swimmer { my (undef, $swimmer) = @_; # save the swimmer } 1; package Trait::Dog; Class::Trait->expects('doggie_treat'); sub swim { # $class might actually be an instance, but we should assume # nothing about the internals of the object my ($class, $target) = @_; Trait::Dog::_eat($class->doggie_treat); # swim to $target } sub _eat { # this must be called via a fully qualified name because private # methods are not flattened into the primary class } 1;