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'] );
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'
],
},
);
=head2 Implementation and Immutability
This module will add a role to your class's metaclass, See
-L<MooseX::ClassAttribute::Role::Meta::Class> for details. This role
+L<MooseX::ClassAttribute::Trait::Class> for details. This role
provides introspection methods for class attributes.
Class attributes themselves do the
-L<MooseX::ClassAttribute::Role::Meta::Attribute> role.
+L<MooseX::ClassAttribute::Trait::Attribute> role.
There is also a L<MooseX::ClassAttribute::Meta::Method::Accessor>
which provides part of the inlining implementation for class
$options{traits} = [
uniq( @{ $options{traits} || [] } ),
- 'MooseX::ClassAttribute::Role::Meta::Attribute'
+ 'MooseX::ClassAttribute::Trait::Attribute'
];
return $class->SUPER::new( $name, %options );
-package MooseX::ClassAttribute::Role::Meta::Application;
+package MooseX::ClassAttribute::Trait::Application;
use strict;
use warnings;
-package MooseX::ClassAttribute::Role::Meta::Application::ToClass;
+package MooseX::ClassAttribute::Trait::Application::ToClass;
use strict;
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;
$class = Moose::Util::MetaRole::apply_metaclass_roles(
for => $class,
class_metaroles => {
- class => ['MooseX::ClassAttribute::Role::Meta::Class'],
+ class => ['MooseX::ClassAttribute::Trait::Class'],
},
);
-package MooseX::ClassAttribute::Role::Meta::Application::ToInstance;
+package MooseX::ClassAttribute::Trait::Application::ToInstance;
use strict;
use warnings;
my $class = Moose::Util::MetaRole::apply_metaclass_roles(
for => ref $object,
class_metaroles => {
- class => ['MooseX::ClassAttribute::Role::Meta::Class'],
+ class => ['MooseX::ClassAttribute::Trait::Class'],
},
);
-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;
$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'
],
},
);
-package MooseX::ClassAttribute::Role::Meta::Attribute;
+package MooseX::ClassAttribute::Trait::Attribute;
use strict;
use warnings;
=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
-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'],
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 );
=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
-package MooseX::ClassAttribute::Role::Meta::Mixin::HasClassAttributes;
+package MooseX::ClassAttribute::Trait::Mixin::HasClassAttributes;
use strict;
use warnings;
-package MooseX::ClassAttribute::Role::Meta::Role;
+package MooseX::ClassAttribute::Trait::Role;
use strict;
use warnings;
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;
=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
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
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' => [ '.+' ]
);