From: Jesse Luehrs Date: Mon, 15 Nov 2010 21:00:41 +0000 (-0600) Subject: lazily load the native trait accessor roles X-Git-Tag: 1.9900~59 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd6a26a2335551f8b8ebd22bf70d177d017773f2;p=gitmo%2FMoose.git lazily load the native trait accessor roles --- diff --git a/lib/Moose/Meta/Attribute/Native/Trait.pm b/lib/Moose/Meta/Attribute/Native/Trait.pm index cef68b7..70dda01 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait.pm @@ -169,6 +169,7 @@ sub _native_accessor_class_for { . $self->_native_type . '::' . $suffix; + Class::MOP::load_class($role); return Moose::Meta::Class->create_anon_class( superclasses => [ $self->accessor_metaclass, $self->delegation_metaclass ], diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm index 71b7fdb..5497fc0 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm @@ -6,31 +6,6 @@ our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use Moose::Meta::Method::Accessor::Native::Array::accessor; -use Moose::Meta::Method::Accessor::Native::Array::clear; -use Moose::Meta::Method::Accessor::Native::Array::count; -use Moose::Meta::Method::Accessor::Native::Array::delete; -use Moose::Meta::Method::Accessor::Native::Array::elements; -use Moose::Meta::Method::Accessor::Native::Array::first; -use Moose::Meta::Method::Accessor::Native::Array::get; -use Moose::Meta::Method::Accessor::Native::Array::grep; -use Moose::Meta::Method::Accessor::Native::Array::insert; -use Moose::Meta::Method::Accessor::Native::Array::is_empty; -use Moose::Meta::Method::Accessor::Native::Array::join; -use Moose::Meta::Method::Accessor::Native::Array::map; -use Moose::Meta::Method::Accessor::Native::Array::natatime; -use Moose::Meta::Method::Accessor::Native::Array::pop; -use Moose::Meta::Method::Accessor::Native::Array::push; -use Moose::Meta::Method::Accessor::Native::Array::reduce; -use Moose::Meta::Method::Accessor::Native::Array::set; -use Moose::Meta::Method::Accessor::Native::Array::shift; -use Moose::Meta::Method::Accessor::Native::Array::shuffle; -use Moose::Meta::Method::Accessor::Native::Array::splice; -use Moose::Meta::Method::Accessor::Native::Array::sort; -use Moose::Meta::Method::Accessor::Native::Array::sort_in_place; -use Moose::Meta::Method::Accessor::Native::Array::uniq; -use Moose::Meta::Method::Accessor::Native::Array::unshift; - with 'Moose::Meta::Attribute::Native::Trait'; sub _helper_type { 'ArrayRef' } diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Bool.pm b/lib/Moose/Meta/Attribute/Native/Trait/Bool.pm index 3fdbdba..49ea089 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Bool.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Bool.pm @@ -5,11 +5,6 @@ our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use Moose::Meta::Method::Accessor::Native::Bool::not; -use Moose::Meta::Method::Accessor::Native::Bool::set; -use Moose::Meta::Method::Accessor::Native::Bool::toggle; -use Moose::Meta::Method::Accessor::Native::Bool::unset; - with 'Moose::Meta::Attribute::Native::Trait'; sub _default_is { 'rw' } diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Code.pm b/lib/Moose/Meta/Attribute/Native/Trait/Code.pm index c423de5..f8457da 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Code.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Code.pm @@ -5,9 +5,6 @@ our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use Moose::Meta::Method::Accessor::Native::Code::execute; -use Moose::Meta::Method::Accessor::Native::Code::execute_method; - with 'Moose::Meta::Attribute::Native::Trait'; sub _helper_type { 'CodeRef' } diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Counter.pm b/lib/Moose/Meta/Attribute/Native/Trait/Counter.pm index 0cbf53f..ac0c17a 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Counter.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Counter.pm @@ -6,11 +6,6 @@ our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use Moose::Meta::Method::Accessor::Native::Counter::dec; -use Moose::Meta::Method::Accessor::Native::Counter::inc; -use Moose::Meta::Method::Accessor::Native::Counter::reset; -use Moose::Meta::Method::Accessor::Native::Counter::set; - with 'Moose::Meta::Attribute::Native::Trait' => { -excludes => ['_root_types'] }; diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm index 9b07e2f..775b735 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Hash.pm @@ -6,20 +6,6 @@ our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use Moose::Meta::Method::Accessor::Native::Hash::accessor; -use Moose::Meta::Method::Accessor::Native::Hash::clear; -use Moose::Meta::Method::Accessor::Native::Hash::count; -use Moose::Meta::Method::Accessor::Native::Hash::defined; -use Moose::Meta::Method::Accessor::Native::Hash::delete; -use Moose::Meta::Method::Accessor::Native::Hash::elements; -use Moose::Meta::Method::Accessor::Native::Hash::exists; -use Moose::Meta::Method::Accessor::Native::Hash::get; -use Moose::Meta::Method::Accessor::Native::Hash::is_empty; -use Moose::Meta::Method::Accessor::Native::Hash::keys; -use Moose::Meta::Method::Accessor::Native::Hash::kv; -use Moose::Meta::Method::Accessor::Native::Hash::set; -use Moose::Meta::Method::Accessor::Native::Hash::values; - with 'Moose::Meta::Attribute::Native::Trait'; sub _helper_type { 'HashRef' } diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Number.pm b/lib/Moose/Meta/Attribute/Native/Trait/Number.pm index b15158e..2b47e0a 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Number.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Number.pm @@ -5,14 +5,6 @@ our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use Moose::Meta::Method::Accessor::Native::Number::abs; -use Moose::Meta::Method::Accessor::Native::Number::add; -use Moose::Meta::Method::Accessor::Native::Number::div; -use Moose::Meta::Method::Accessor::Native::Number::mod; -use Moose::Meta::Method::Accessor::Native::Number::mul; -use Moose::Meta::Method::Accessor::Native::Number::set; -use Moose::Meta::Method::Accessor::Native::Number::sub; - with 'Moose::Meta::Attribute::Native::Trait'; sub _helper_type { 'Num' } diff --git a/lib/Moose/Meta/Attribute/Native/Trait/String.pm b/lib/Moose/Meta/Attribute/Native/Trait/String.pm index 4536dab..50a1091 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/String.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/String.pm @@ -5,17 +5,6 @@ our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use Moose::Meta::Method::Accessor::Native::String::append; -use Moose::Meta::Method::Accessor::Native::String::chomp; -use Moose::Meta::Method::Accessor::Native::String::chop; -use Moose::Meta::Method::Accessor::Native::String::clear; -use Moose::Meta::Method::Accessor::Native::String::inc; -use Moose::Meta::Method::Accessor::Native::String::length; -use Moose::Meta::Method::Accessor::Native::String::match; -use Moose::Meta::Method::Accessor::Native::String::prepend; -use Moose::Meta::Method::Accessor::Native::String::replace; -use Moose::Meta::Method::Accessor::Native::String::substr; - with 'Moose::Meta::Attribute::Native::Trait'; sub _default_default { q{} }