package Hello; use Moose::Role; use namespace::autoclean; # Insist that someone who "with"s us, has a greet method requires "greet"; sub hello_world { my $self = shift; $self->greet("hello world\n"); } 1; #### package Greeting; use Moose; use namespace::autoclean; with 'Hello'; sub greet { my ($self, @stuff) = @_; print @stuff; } __PACKAGE__->meta->make_immutable; 1; #### package Greeting2; use Moose; use namespace::autoclean; with 'Hello'; sub greet { my ($self, @stuff) = @_; print map uc($_), @stuff; } __PACKAGE__->meta->make_immutable; 1; #### package Greeting3; use Moose; use namespace::autoclean; extends 'Greeting'; # already "with" Hello __PACKAGE__->meta->make_immutable; 1; #### Greeting=HASH(0x2b411f8) does Hello hello world Greeting2=HASH(0x1a541f8) does Hello HELLO WORLD Greeting3=HASH(0x15c01f8) does Hello hello world