[libmoo-perl] 20/43: fix create_class_with_roles again with acc gen role

gregor herrmann gregoa at debian.org
Mon Dec 26 17:56:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libmoo-perl.

commit 52fe7a36963c5b42967a62f37a8f2849360f9498
Author: Graham Knop <haarg at haarg.org>
Date:   Thu Dec 1 20:43:16 2016 -0500

    fix create_class_with_roles again with acc gen role
---
 lib/Moo/Role.pm                  | 1 +
 t/accessor-generator-extension.t | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/lib/Moo/Role.pm b/lib/Moo/Role.pm
index bbc1d37..6f95bdf 100644
--- a/lib/Moo/Role.pm
+++ b/lib/Moo/Role.pm
@@ -330,6 +330,7 @@ sub create_class_with_roles {
   if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) {
     Moo::HandleMoose::inject_fake_metaclass_for($new_name);
   }
+  $COMPOSED{class}{$new_name} = 1;
   _set_loaded($new_name, (caller)[1]);
   return $new_name;
 }
diff --git a/t/accessor-generator-extension.t b/t/accessor-generator-extension.t
index a4ae826..be840de 100644
--- a/t/accessor-generator-extension.t
+++ b/t/accessor-generator-extension.t
@@ -1,5 +1,6 @@
 use Moo::_strictures;
 use Test::More;
+use Test::Fatal;
 
 BEGIN {
   package Method::Generate::Accessor::Role::ArrayRefInstance;
@@ -107,6 +108,11 @@ $o = $c->new(one => 1, two => 2, three => 3, four => 4);
 
 is_deeply([ @$o ], [ 1, 2, 3, 4 ], 'Generated subclass object w/role');
 
+is exception {
+  Moo::Role->create_class_with_roles('ArrayTest1', 'ArrayTestRole');
+}, undef,
+  'creating class with role again';
+
 {
   package ArrayNonMoo;
   sub new { bless [], $_[0] }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmoo-perl.git



More information about the Pkg-perl-cvs-commits mailing list