From: Dave Rolsky Date: Tue, 9 Feb 2010 23:02:47 +0000 (-0600) Subject: Rename all MX::CA::Role::Meta packages to MX::CA::Trait, which is shorter and less... X-Git-Tag: 0.11~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63fcc5089af76b1738850b39823dab675626ebfa;p=gitmo%2FMooseX-ClassAttribute.git Rename all MX::CA::Role::Meta packages to MX::CA::Trait, which is shorter and less confusing with the MX::CA::Meta::Role namespace --- diff --git a/lib/MooseX/ClassAttribute.pm b/lib/MooseX/ClassAttribute.pm index 219b6ff..065ec79 100644 --- a/lib/MooseX/ClassAttribute.pm +++ b/lib/MooseX/ClassAttribute.pm @@ -8,11 +8,11 @@ our $AUTHORITY = 'cpan:DROLSKY'; use Moose 0.89 (); use Moose::Exporter; -use MooseX::ClassAttribute::Role::Meta::Class; -use MooseX::ClassAttribute::Role::Meta::Role; -use MooseX::ClassAttribute::Role::Meta::Application::ToClass; -use MooseX::ClassAttribute::Role::Meta::Application::ToRole; -use MooseX::ClassAttribute::Role::Meta::Application::ToInstance; +use MooseX::ClassAttribute::Trait::Class; +use MooseX::ClassAttribute::Trait::Role; +use MooseX::ClassAttribute::Trait::Application::ToClass; +use MooseX::ClassAttribute::Trait::Application::ToRole; +use MooseX::ClassAttribute::Trait::Application::ToInstance; Moose::Exporter->setup_import_methods( with_meta => ['class_has'] ); @@ -23,16 +23,16 @@ sub init_meta { return Moose::Util::MetaRole::apply_metaclass_roles( for => $p{for_class}, class_metaroles => { - class => ['MooseX::ClassAttribute::Role::Meta::Class'], + class => ['MooseX::ClassAttribute::Trait::Class'], }, role_metaroles => { - role => ['MooseX::ClassAttribute::Role::Meta::Role'], + role => ['MooseX::ClassAttribute::Trait::Role'], application_to_class => - ['MooseX::ClassAttribute::Role::Meta::Application::ToClass'], + ['MooseX::ClassAttribute::Trait::Application::ToClass'], application_to_role => - ['MooseX::ClassAttribute::Role::Meta::Application::ToRole'], + ['MooseX::ClassAttribute::Trait::Application::ToRole'], application_to_instance => [ - 'MooseX::ClassAttribute::Role::Meta::Application::ToInstance' + 'MooseX::ClassAttribute::Trait::Application::ToInstance' ], }, ); @@ -106,11 +106,11 @@ C as well. =head2 Implementation and Immutability This module will add a role to your class's metaclass, See -L for details. This role +L for details. This role provides introspection methods for class attributes. Class attributes themselves do the -L role. +L role. There is also a L which provides part of the inlining implementation for class diff --git a/lib/MooseX/ClassAttribute/Meta/Role/Attribute.pm b/lib/MooseX/ClassAttribute/Meta/Role/Attribute.pm index 88e2740..3141ff4 100644 --- a/lib/MooseX/ClassAttribute/Meta/Role/Attribute.pm +++ b/lib/MooseX/ClassAttribute/Meta/Role/Attribute.pm @@ -15,7 +15,7 @@ sub new { $options{traits} = [ uniq( @{ $options{traits} || [] } ), - 'MooseX::ClassAttribute::Role::Meta::Attribute' + 'MooseX::ClassAttribute::Trait::Attribute' ]; return $class->SUPER::new( $name, %options ); diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Application.pm b/lib/MooseX/ClassAttribute/Trait/Application.pm similarity index 72% rename from lib/MooseX/ClassAttribute/Role/Meta/Application.pm rename to lib/MooseX/ClassAttribute/Trait/Application.pm index 33ee084..3ccf0f7 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Application.pm +++ b/lib/MooseX/ClassAttribute/Trait/Application.pm @@ -1,4 +1,4 @@ -package MooseX::ClassAttribute::Role::Meta::Application; +package MooseX::ClassAttribute::Trait::Application; use strict; use warnings; diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Application/ToClass.pm b/lib/MooseX/ClassAttribute/Trait/Application/ToClass.pm similarity index 81% rename from lib/MooseX/ClassAttribute/Role/Meta/Application/ToClass.pm rename to lib/MooseX/ClassAttribute/Trait/Application/ToClass.pm index 4300f0f..4232b7d 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Application/ToClass.pm +++ b/lib/MooseX/ClassAttribute/Trait/Application/ToClass.pm @@ -1,4 +1,4 @@ -package MooseX::ClassAttribute::Role::Meta::Application::ToClass; +package MooseX::ClassAttribute::Trait::Application::ToClass; use strict; use warnings; @@ -6,7 +6,7 @@ use warnings; use namespace::autoclean; use Moose::Role; -with 'MooseX::ClassAttribute::Role::Meta::Application'; +with 'MooseX::ClassAttribute::Trait::Application'; sub apply_class_attributes { my $self = shift; @@ -16,7 +16,7 @@ sub apply_class_attributes { $class = Moose::Util::MetaRole::apply_metaclass_roles( for => $class, class_metaroles => { - class => ['MooseX::ClassAttribute::Role::Meta::Class'], + class => ['MooseX::ClassAttribute::Trait::Class'], }, ); diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Application/ToInstance.pm b/lib/MooseX/ClassAttribute/Trait/Application/ToInstance.pm similarity index 87% rename from lib/MooseX/ClassAttribute/Role/Meta/Application/ToInstance.pm rename to lib/MooseX/ClassAttribute/Trait/Application/ToInstance.pm index 049b9f2..ef83c22 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Application/ToInstance.pm +++ b/lib/MooseX/ClassAttribute/Trait/Application/ToInstance.pm @@ -1,4 +1,4 @@ -package MooseX::ClassAttribute::Role::Meta::Application::ToInstance; +package MooseX::ClassAttribute::Trait::Application::ToInstance; use strict; use warnings; @@ -20,7 +20,7 @@ sub apply_class_attributes { my $class = Moose::Util::MetaRole::apply_metaclass_roles( for => ref $object, class_metaroles => { - class => ['MooseX::ClassAttribute::Role::Meta::Class'], + class => ['MooseX::ClassAttribute::Trait::Class'], }, ); diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Application/ToRole.pm b/lib/MooseX/ClassAttribute/Trait/Application/ToRole.pm similarity index 68% rename from lib/MooseX/ClassAttribute/Role/Meta/Application/ToRole.pm rename to lib/MooseX/ClassAttribute/Trait/Application/ToRole.pm index 6b6f2cb..b750f42 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Application/ToRole.pm +++ b/lib/MooseX/ClassAttribute/Trait/Application/ToRole.pm @@ -1,16 +1,16 @@ -package MooseX::ClassAttribute::Role::Meta::Application::ToRole; +package MooseX::ClassAttribute::Trait::Application::ToRole; use strict; use warnings; use Moose::Util::MetaRole; -use MooseX::ClassAttribute::Role::Meta::Application::ToClass; -use MooseX::ClassAttribute::Role::Meta::Application::ToInstance; +use MooseX::ClassAttribute::Trait::Application::ToClass; +use MooseX::ClassAttribute::Trait::Application::ToInstance; use namespace::autoclean; use Moose::Role; -with 'MooseX::ClassAttribute::Role::Meta::Application'; +with 'MooseX::ClassAttribute::Trait::Application'; sub apply_class_attributes { my $self = shift; @@ -20,13 +20,13 @@ sub apply_class_attributes { $role2 = Moose::Util::MetaRole::apply_metaclass_roles( for => $role2, role_metaroles => { - role => ['MooseX::ClassAttribute::Role::Meta::Role'], + role => ['MooseX::ClassAttribute::Trait::Role'], application_to_class => - ['MooseX::ClassAttribute::Role::Meta::Application::ToClass'], + ['MooseX::ClassAttribute::Trait::Application::ToClass'], application_to_role => - ['MooseX::ClassAttribute::Role::Meta::Application::ToRole'], + ['MooseX::ClassAttribute::Trait::Application::ToRole'], application_to_instance => [ - 'MooseX::ClassAttribute::Role::Meta::Application::ToInstance' + 'MooseX::ClassAttribute::Trait::Application::ToInstance' ], }, ); diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Attribute.pm b/lib/MooseX/ClassAttribute/Trait/Attribute.pm similarity index 95% rename from lib/MooseX/ClassAttribute/Role/Meta/Attribute.pm rename to lib/MooseX/ClassAttribute/Trait/Attribute.pm index be59f19..a4a2b93 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Attribute.pm +++ b/lib/MooseX/ClassAttribute/Trait/Attribute.pm @@ -1,4 +1,4 @@ -package MooseX::ClassAttribute::Role::Meta::Attribute; +package MooseX::ClassAttribute::Trait::Attribute; use strict; use warnings; @@ -133,7 +133,7 @@ __END__ =head1 NAME -MooseX::ClassAttribute::Role::Meta::Attribute - An attribute role for classes with class attributes +MooseX::ClassAttribute::Trait::Attribute - An attribute role for classes with class attributes =head1 DESCRIPTION diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Class.pm b/lib/MooseX/ClassAttribute/Trait/Class.pm similarity index 94% rename from lib/MooseX/ClassAttribute/Role/Meta/Class.pm rename to lib/MooseX/ClassAttribute/Trait/Class.pm index 8ec293b..3bb887c 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Class.pm +++ b/lib/MooseX/ClassAttribute/Trait/Class.pm @@ -1,15 +1,15 @@ -package MooseX::ClassAttribute::Role::Meta::Class; +package MooseX::ClassAttribute::Trait::Class; use strict; use warnings; -use MooseX::ClassAttribute::Role::Meta::Attribute; +use MooseX::ClassAttribute::Trait::Attribute; use Scalar::Util qw( blessed ); use namespace::autoclean; use Moose::Role; -with 'MooseX::ClassAttribute::Role::Meta::Mixin::HasClassAttributes'; +with 'MooseX::ClassAttribute::Trait::Mixin::HasClassAttributes'; has _class_attribute_values => ( traits => ['Hash'], @@ -87,10 +87,10 @@ sub _process_new_class_attribute { my %p = @_; if ( $p{traits} ) { - push @{ $p{traits} }, 'MooseX::ClassAttribute::Role::Meta::Attribute'; + push @{ $p{traits} }, 'MooseX::ClassAttribute::Trait::Attribute'; } else { - $p{traits} = ['MooseX::ClassAttribute::Role::Meta::Attribute']; + $p{traits} = ['MooseX::ClassAttribute::Trait::Attribute']; } return Moose::Meta::Attribute->interpolate_class_and_new( $name, %p ); @@ -231,7 +231,7 @@ __END__ =head1 NAME -MooseX::ClassAttribute::Role::Meta::Class - A metaclass role for classes with class attributes +MooseX::ClassAttribute::Trait::Class - A metaclass role for classes with class attributes =head1 SYNOPSIS diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Mixin/HasClassAttributes.pm b/lib/MooseX/ClassAttribute/Trait/Mixin/HasClassAttributes.pm similarity index 96% rename from lib/MooseX/ClassAttribute/Role/Meta/Mixin/HasClassAttributes.pm rename to lib/MooseX/ClassAttribute/Trait/Mixin/HasClassAttributes.pm index 3531f15..ab875c2 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Mixin/HasClassAttributes.pm +++ b/lib/MooseX/ClassAttribute/Trait/Mixin/HasClassAttributes.pm @@ -1,4 +1,4 @@ -package MooseX::ClassAttribute::Role::Meta::Mixin::HasClassAttributes; +package MooseX::ClassAttribute::Trait::Mixin::HasClassAttributes; use strict; use warnings; diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Role.pm b/lib/MooseX/ClassAttribute/Trait/Role.pm similarity index 93% rename from lib/MooseX/ClassAttribute/Role/Meta/Role.pm rename to lib/MooseX/ClassAttribute/Trait/Role.pm index 3530dc6..6f86e25 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Role.pm +++ b/lib/MooseX/ClassAttribute/Trait/Role.pm @@ -1,4 +1,4 @@ -package MooseX::ClassAttribute::Role::Meta::Role; +package MooseX::ClassAttribute::Trait::Role; use strict; use warnings; @@ -9,7 +9,7 @@ use Scalar::Util qw( blessed ); use namespace::autoclean; use Moose::Role; -with 'MooseX::ClassAttribute::Role::Meta::Mixin::HasClassAttributes'; +with 'MooseX::ClassAttribute::Trait::Mixin::HasClassAttributes'; around add_class_attribute => sub { my $orig = shift; @@ -39,7 +39,7 @@ __END__ =head1 NAME -MooseX::ClassAttribute::Role::Meta::Class - A metaclass role for classes with class attributes +MooseX::ClassAttribute::Trait::Class - A metaclass role for classes with class attributes =head1 SYNOPSIS diff --git a/t/03-introspection.t b/t/03-introspection.t index 3ea04b0..dee90d1 100644 --- a/t/03-introspection.t +++ b/t/03-introspection.t @@ -15,8 +15,8 @@ ok( ok( HasClassAttribute->meta()->get_class_attribute('ObjectCount')->meta() - ->does_role('MooseX::ClassAttribute::Role::Meta::Attribute'), - 'get_class_attribute_list returns an object which does the MooseX::ClassAttribute::Role::Meta::Attribute role' + ->does_role('MooseX::ClassAttribute::Trait::Attribute'), + 'get_class_attribute_list returns an object which does the MooseX::ClassAttribute::Trait::Attribute role' ); my @ca = qw( Delegatee diff --git a/t/pod-coverage.t b/t/pod-coverage.t index 5c57228..03241db 100644 --- a/t/pod-coverage.t +++ b/t/pod-coverage.t @@ -17,7 +17,7 @@ plan tests => scalar @modules; my %trustme = ( 'MooseX::ClassAttribute' => [ 'init_meta', 'class_has' ], - 'MooseX::ClassAttribute::Role::Meta::Class' => [ 'compute_all_applicable_class_attributes' ], + 'MooseX::ClassAttribute::Trait::Class' => [ 'compute_all_applicable_class_attributes' ], 'MooseX::ClassAttribute::Meta::Method::Accessor' => [ '.+' ] );