From: gfx Date: Fri, 14 Aug 2009 02:22:16 +0000 (+0900) Subject: Refuse -extends on Moose::Role X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5fd0e715c43a7695fcee2bc5a068a61a862828dc;p=gitmo%2FMoose.git Refuse -extends on Moose::Role --- diff --git a/lib/Moose/Exporter.pm b/lib/Moose/Exporter.pm index e85420e..e4fdbf0 100644 --- a/lib/Moose/Exporter.pm +++ b/lib/Moose/Exporter.pm @@ -433,7 +433,7 @@ sub _make_import_sub { } if ( @superclasses ) { - if ( $did_init_meta ) { + if ( $did_init_meta && !$CALLER->meta->isa('Moose::Meta::Role') ) { # superclasses() can load classes using Moose or Moose::Role, # which uses Moose::Exporter, which in turn sets $CALLER, so we need # to protect against that. @@ -443,7 +443,9 @@ sub _make_import_sub { else { require Moose; Moose->throw_error( - "Cannot provide -extends when $class does not have an init_meta() method" + $did_init_meta + ? "Roles do not support '-extends'" + : "Cannot provide -extends when $class does not have an init_meta() method" ); } }