Permalink
Browse files

Support for creating a method object without the code ref. CatalystX:…

…:Declare seems to require it.
  • Loading branch information...
1 parent de71033 commit 26dd46f17d9273a57b7beb54a8703028be758981 @ruoso ruoso committed Jun 7, 2010
Showing with 21 additions and 3 deletions.
  1. +4 −0 Changes
  2. +1 −1 lib/MooseX/Method/Signatures.pm
  3. +1 −1 lib/MooseX/Method/Signatures/Meta/Method.pm
  4. +15 −1 t/meta.t
View
@@ -1,5 +1,9 @@
Version history for MooseX::Method::Signatures
+0.33 Thu, 01 Jun 2010 13:47:34 -0300
+ * CatalystX::Declare seems to create a method object without a code
+ reference at all.
+
0.32 Thu, 01 Jun 2010 13:47:34 -0300
* Detect usage of old MXMS::Meta::Method API and retro-compatibilize.
@@ -19,7 +19,7 @@ use aliased 'Devel::Declare::Context::Simple', 'ContextSimple';
use namespace::autoclean;
-our $VERSION = '0.32';
+our $VERSION = '0.33';
has package => (
is => 'ro',
@@ -161,7 +161,7 @@ around wrap => sub {
}
my $wrapped = $class->_wrapped_body(\$self, %args);
- $self = $class->$orig($wrapped, %args, actual_body => $code);
+ $self = $class->$orig($wrapped, %args, $code ? (actual_body => $code) : ());
# Vivify the type constraints so TC lookups happen before namespace::clean
# removes them
View
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 7;
use Test::Exception;
use MooseX::Method::Signatures::Meta::Method;
@@ -58,3 +58,17 @@ lives_and(sub {
dies_ok(sub {
Bar->bar(foo => 'moo', bar => 'baz');
});
+
+
+# CatalystX::Declare seems to create a method without a code at all.
+lives_and(sub {
+ package Bar;
+ use metaclass;
+
+ my $method = MooseX::Method::Signatures::Meta::Method->wrap(
+ signature => '($class: Int :$foo, Str :$bar)',
+ package_name => __PACKAGE__,
+ name => 'bar',
+ );
+ ::isa_ok($method, 'Moose::Meta::Method');
+});

0 comments on commit 26dd46f

Please sign in to comment.