From: Justin Hunter Date: Fri, 4 Sep 2009 04:36:37 +0000 (-0700) Subject: migrate from MXAH to Native::Trait X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=720dcdc376d9744bbc230d06530eaa7b59a35973;p=dbsrgits%2FSQL-Translator-2.0-ish.git migrate from MXAH to Native::Trait --- diff --git a/lib/SQL/Translator/Object.pm b/lib/SQL/Translator/Object.pm index b593f02..a6640b9 100644 --- a/lib/SQL/Translator/Object.pm +++ b/lib/SQL/Translator/Object.pm @@ -5,39 +5,39 @@ class SQL::Translator::Object { use MooseX::Types::Moose qw(Any ArrayRef HashRef Str); has '_comments' => ( - metaclass => 'Collection::Array', + traits => ['Array'], is => 'rw', isa => ArrayRef, - provides => { - push => 'add_comment', - pop => 'remove_last_comment', + handles => { + add_comment => 'push', + remove_last_comment => 'pop', }, default => sub { [] }, auto_deref => 1, ); has '_options' => ( - metaclass => 'Collection::Array', + traits => ['Array'], is => 'rw', isa => ArrayRef, - provides => { - push => 'add_option', - pop => 'remove_last_option', + handles => { + add_option => 'push', + remove_last_option => 'pop', }, default => sub { [] }, auto_deref => 1, ); has '_extra' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef, - provides => { - exists => 'exists_extra', - keys => 'extra_ids', - values => 'get_extras', - get => 'get_extra', - set => 'add_extra', + handles => { + exists_extra => 'exists', + extra_ids => 'keys', + get_extras => 'values', + get_extra => 'get', + add_extra => 'set', }, default => sub { {} }, auto_deref => 1, diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm index 6813a15..5b92e33 100644 --- a/lib/SQL/Translator/Object/Table.pm +++ b/lib/SQL/Translator/Object/Table.pm @@ -1,7 +1,6 @@ use MooseX::Declare; class SQL::Translator::Object::Table extends SQL::Translator::Object { use MooseX::Types::Moose qw(Any Bool HashRef Str); - use MooseX::AttributeHelpers; use MooseX::MultiMethods; use SQL::Translator::Types qw(Column Constraint Index Schema Sequence); @@ -12,57 +11,57 @@ class SQL::Translator::Object::Table extends SQL::Translator::Object { ); has 'columns' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef[Column], - provides => { - exists => 'exists_column', - keys => 'column_ids', - values => 'get_columns', - get => 'get_column', - set => 'add_column', + handles => { + exists_column => 'exists', + column_ids => 'keys', + get_columns => 'values', + get_column => 'get', + add_column => 'set', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); has 'indexes' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef[Index], - provides => { - exists => 'exists_index', - keys => 'index_ids', - values => 'get_indices', - get => 'get_index', - set => 'add_index', + handles => { + exists_index => 'exists', + index_ids => 'keys', + get_indices => 'values', + get_index => 'get', + add_index => 'set', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); has 'constraints' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef[Constraint], - provides => { - exists => 'exists_constraint', - keys => 'constraint_ids', - values => 'get_constraints', - get => 'get_constraint', - set => 'add_constraint', + handles => { + exists_constraint => 'exists', + constraint_ids => 'keys', + get_constraints => 'values', + get_constraint => 'get', + add_constraint => 'set', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); has 'sequences' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef[Sequence], - provides => { - exists => 'exists_sequence', - keys => 'sequence_ids', - values => 'get_sequences', - get => 'get_sequence', - set => 'add_sequence', + handles => { + exists_sequence => 'exists', + sequence_ids => 'keys', + get_sequences => 'values', + get_sequence => 'get', + add_sequence => 'set', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, );