Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…:Declare seems to require it.
  • Loading branch information...
commit 26dd46f17d9273a57b7beb54a8703028be758981 1 parent de71033
@ruoso ruoso authored
View
4 Changes
@@ -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.
View
2  lib/MooseX/Method/Signatures.pm
@@ -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',
View
2  lib/MooseX/Method/Signatures/Meta/Method.pm
@@ -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
16 t/meta.t
@@ -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');
+});
Please sign in to comment.
Something went wrong with that request. Please try again.