#!/usr/bin/env perl
package MooseX::Role::Parameterized;
-use Moose qw/extends around confess/;
+use Moose (
+ extends => { -as => 'moose_extends' },
+ qw/around confess/,
+);
+
+use Carp 'croak';
use Moose::Role ();
-extends 'Moose::Exporter';
+moose_extends 'Moose::Exporter';
use MooseX::Role::Parameterized::Meta::Role::Parameterizable;
__PACKAGE__->setup_import_methods(
with_caller => ['parameter', 'role', 'method'],
- as_is => ['has'],
+ as_is => ['has', 'extends', 'augment', 'inner'],
);
sub parameter {
$CURRENT_METACLASS->add_method($name => $method);
}
+sub extends { croak "Roles do not currently support 'extends'" }
+
+sub inner { croak "Roles cannot support 'inner'" }
+
+sub augment { croak "Roles cannot support 'augment'" }
+
1;
--- /dev/null
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+use Test::Exception;
+
+do {
+ package MyRole::Storage;
+ use MooseX::Role::Parameterized;
+
+ role {
+ ::throws_ok {
+ extends 'MyRole::Parameterized';
+ } qr/^Roles do not currently support 'extends'/;
+ ::throws_ok {
+ inner()
+ } qr/^Roles cannot support 'inner'/;
+ ::throws_ok {
+ augment()
+ } qr/^Roles cannot support 'augment'/;
+ };
+};
+
+Moose::Meta::Class->create_anon_class(
+ roles => ['MyRole::Storage'],
+);
+