From: Dave Rolsky Date: Sat, 21 Aug 2010 16:17:44 +0000 (-0500) Subject: Issue a deprecation warning for alias or excludes (sans leading dash) X-Git-Tag: 1.10~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=82f8ace6fea9c4cd5ddf5b34ecc84a5d436c513e;p=gitmo%2FMoose.git Issue a deprecation warning for alias or excludes (sans leading dash) --- diff --git a/Changes b/Changes index 469977f..7c9a99b 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,12 @@ for, noteworthy changes. NEXT + [API CHANGES] + + * The long-deprecated alias and excludes options for role applications now + issue a deprecation warning. Use -alias and -excludes instead. (Dave + Rolsky) + [BUG FIXES] * Inlined code no longer stringifies numeric attribute defaults. (vg, doy) diff --git a/lib/Moose/Deprecated.pm b/lib/Moose/Deprecated.pm index 369641f..9908df3 100644 --- a/lib/Moose/Deprecated.pm +++ b/lib/Moose/Deprecated.pm @@ -10,6 +10,7 @@ our $AUTHORITY = 'cpan:STEVAN'; use Package::DeprecationManager -deprecations => { 'coerce without coercion' => '1.08', 'pre-0.94 MetaRole API' => '0.94', + 'alias or excludes' => '0.89', 'Role type' => '0.84', 'subtype without sugar' => '0.72', 'type without sugar' => '0.72', diff --git a/lib/Moose/Meta/Role/Application.pm b/lib/Moose/Meta/Role/Application.pm index c4aa79c..98a346f 100644 --- a/lib/Moose/Meta/Role/Application.pm +++ b/lib/Moose/Meta/Role/Application.pm @@ -23,6 +23,14 @@ __PACKAGE__->meta->add_attribute('method_aliases' => ( sub new { my ($class, %params) = @_; + if ( exists $params{excludes} || exists $params{alias} ) { + Moose::Deprecated::deprecated( + feature => 'alias or excludes', + message => + "The alias and excludes options for role application have been renamed -alias and -excludes" + ); + } + if ( exists $params{excludes} && !exists $params{'-excludes'} ) { $params{'-excludes'} = delete $params{excludes}; } diff --git a/t/030_roles/019_build.t b/t/030_roles/019_build.t index 1dfc912..0efd76d 100644 --- a/t/030_roles/019_build.t +++ b/t/030_roles/019_build.t @@ -39,7 +39,7 @@ do { use Moose; ::stderr_is { - with 'TestRole' => { excludes => 'BUILD' }; + with 'TestRole' => { -excludes => 'BUILD' }; } ''; sub BUILD { push @CALLS, 'ExplicitClassWithBUILD::BUILD' } diff --git a/t/100_bugs/029_instance_application_role_args.t b/t/100_bugs/029_instance_application_role_args.t index 9c29a0e..9a3e238 100644 --- a/t/100_bugs/029_instance_application_role_args.t +++ b/t/100_bugs/029_instance_application_role_args.t @@ -44,7 +44,7 @@ use Test::Exception; my $p = Point->new( x => 4, y => 3 ); -DoesTranspose->meta->apply( $p, alias => { transpose => 'negated' } ); +DoesTranspose->meta->apply( $p, -alias => { transpose => 'negated' } ); is_deeply($p->negated->inspect, [3, 4]); is_deeply($p->transpose->inspect, [3, 4]); diff --git a/t/lib/Role/Child.pm b/t/lib/Role/Child.pm index bf5aa25..4c70436 100644 --- a/t/lib/Role/Child.pm +++ b/t/lib/Role/Child.pm @@ -1,7 +1,7 @@ package Role::Child; use Moose::Role; -with 'Role::Parent' => { alias => { meth1 => 'aliased_meth1', } }; +with 'Role::Parent' => { -alias => { meth1 => 'aliased_meth1', } }; sub meth1 { }