From: Shawn M Moore Date: Mon, 8 Dec 2008 01:16:31 +0000 (+0000) Subject: Using "parameter" inside the role block is an error X-Git-Tag: 0.05~33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4f3cfe3fd5a511e6503fcc1da85fb937a7d67863;p=gitmo%2FMooseX-Role-Parameterized.git Using "parameter" inside the role block is an error --- diff --git a/lib/MooseX/Role/Parameterized.pm b/lib/MooseX/Role/Parameterized.pm index 441c971..83e88ed 100644 --- a/lib/MooseX/Role/Parameterized.pm +++ b/lib/MooseX/Role/Parameterized.pm @@ -21,6 +21,10 @@ __PACKAGE__->setup_import_methods( sub parameter { my $caller = shift; + + confess "'parameter' may not be used inside of the role block" + if $CURRENT_METACLASS; + my $meta = Class::MOP::Class->initialize($caller); my $names = shift; diff --git a/t/100-erroneous-keywords.t b/t/100-erroneous-keywords.t index fabcecf..759780e 100644 --- a/t/100-erroneous-keywords.t +++ b/t/100-erroneous-keywords.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 5; use Test::Exception; @@ -23,6 +23,9 @@ do { ::throws_ok { augment() } qr/^Roles cannot support 'augment'/; + ::throws_ok { + parameter() + } qr/^'parameter' may not be used inside of the role block/; }; };