diff --git a/lib/MooseX/Method/Signatures/Meta/Method.pm b/lib/MooseX/Method/Signatures/Meta/Method.pm index 379e711..ea5a3b8 100644 --- a/lib/MooseX/Method/Signatures/Meta/Method.pm +++ b/lib/MooseX/Method/Signatures/Meta/Method.pm @@ -174,6 +174,16 @@ around wrap => sub { return $self; }; +sub reify { + my $self = shift; + + my %other_args = %{$self}; + delete $other_args{body}; + delete $other_args{actual_body}; + + return $self->meta->name->wrap($self->body, %other_args, @_); +} + sub _build_parsed_signature { my ($self) = @_; return Parse::Method::Signatures->signature( diff --git a/t/meta.t b/t/meta.t index 02f38c9..85bab9d 100644 --- a/t/meta.t +++ b/t/meta.t @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 8; use Test::Exception; use MooseX::Method::Signatures::Meta::Method; @@ -71,4 +71,11 @@ lives_and(sub { name => 'bar', ); ::isa_ok($method, 'Moose::Meta::Method'); + + # CatalystX::Declare uses reify directly. too bad. + my $other = $method->reify + ( actual_body => sub { }, + ); + ::isa_ok($method, 'Moose::Meta::Method'); + });