package MyRole2 use Moo::Role; sub call { my $self = shift; # Connect to server, retrieve a document my $document = $self->get_document; return $document; } package MyClass2; use Moo; with 'MyRole2'; around call = sub { my ($orig, $self) = @_; my $document = $self->$orig; if (has_error($document)) { die 'Error'; } return parse($document); };