package AtomicMethod::Role::Method; use Moose::Role; around wrap => sub { my ($orig, $self, $body, @args) = @_; my $new_body = sub { warn "locking...\n"; # or something more useful my @ret = $body->(@_); # TODO: handle context properly warn "unlocking...\n"; # or something more useful return @ret; }; $self->$orig($new_body, @args); };