params{item_id}, )->call; # ... } controller package Context::Cart sub new { my ($class, $user, $item_id) = @_; $user->extend(“Role::Customer”); bless { user => $user, item_id => $item_id, }, $class; } sub call { my $self = shift; $self->{user}->add_cart( $self->{item_id} ); } { package Role::Customer; sub add_cart { ... } } context https://github.com/kentaro/Class-Extendable `$user->extend` is enabled by my experimental module, Class::Extendable.