From: Justin Hunter Date: Fri, 4 Sep 2009 04:35: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=28bd628e570cb298bf33fb144d44b042e262ce40;p=dbsrgits%2FSQL-Translator-2.0-ish.git migrate from MXAH to Native::Trait --- diff --git a/lib/SQL/Translator/Object/Constraint.pm b/lib/SQL/Translator/Object/Constraint.pm index e27d19a..266ae4f 100644 --- a/lib/SQL/Translator/Object/Constraint.pm +++ b/lib/SQL/Translator/Object/Constraint.pm @@ -1,7 +1,6 @@ use MooseX::Declare; class SQL::Translator::Object::Constraint extends SQL::Translator::Object { use MooseX::Types::Moose qw(ArrayRef Bool HashRef Maybe Str Undef); - use MooseX::AttributeHelpers; use SQL::Translator::Types qw(Column Table); has 'table' => ( @@ -18,15 +17,15 @@ class SQL::Translator::Object::Constraint 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 }, ); diff --git a/lib/SQL/Translator/Object/Index.pm b/lib/SQL/Translator/Object/Index.pm index 1c3ef51..ccb2dd4 100644 --- a/lib/SQL/Translator/Object/Index.pm +++ b/lib/SQL/Translator/Object/Index.pm @@ -1,7 +1,6 @@ use MooseX::Declare; class SQL::Translator::Object::Index extends SQL::Translator::Object { use MooseX::Types::Moose qw(HashRef Str); - use MooseX::AttributeHelpers; use SQL::Translator::Types qw(Column Table); has 'table' => ( @@ -18,15 +17,15 @@ class SQL::Translator::Object::Index 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 }, ); diff --git a/lib/SQL/Translator/Object/Procedure.pm b/lib/SQL/Translator/Object/Procedure.pm index 006f37a..b77425c 100644 --- a/lib/SQL/Translator/Object/Procedure.pm +++ b/lib/SQL/Translator/Object/Procedure.pm @@ -1,7 +1,6 @@ use MooseX::Declare; class SQL::Translator::Object::Procedure extends SQL::Translator::Object { use MooseX::Types::Moose qw(ArrayRef Str); - use MooseX::AttributeHelpers; use MooseX::MultiMethods; has 'name' => ( @@ -17,12 +16,12 @@ class SQL::Translator::Object::Procedure extends SQL::Translator::Object { ); has '_parameters' => ( - metaclass => 'Collection::Array', + traits => ['Array'], is => 'rw', isa => ArrayRef, - provides => { - push => 'add_parameter', - pop => 'remove_last_parameter', + handles => { + add_parameter => 'push', + remove_last_parameter => 'pop', }, default => sub { [] }, auto_deref => 1, diff --git a/lib/SQL/Translator/Object/Schema.pm b/lib/SQL/Translator/Object/Schema.pm index 99d0423..b9ab39a 100644 --- a/lib/SQL/Translator/Object/Schema.pm +++ b/lib/SQL/Translator/Object/Schema.pm @@ -1,7 +1,6 @@ use MooseX::Declare; class SQL::Translator::Object::Schema extends SQL::Translator::Object { use MooseX::Types::Moose qw(HashRef Maybe Str); - use MooseX::AttributeHelpers; use SQL::Translator::Types qw(Procedure Table Trigger View); has 'name' => ( @@ -12,57 +11,57 @@ class SQL::Translator::Object::Schema extends SQL::Translator::Object { ); has 'tables' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef[Table], - provides => { - exists => 'exists_table', - keys => 'table_ids', - values => 'get_tables', - get => 'get_table', - set => 'add_table', + handles => { + exists_table => 'exists', + table_ids => 'keys', + get_tables => 'values', + get_table => 'get', + add_table => 'set', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); has 'views' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef[View], - provides => { - exists => 'exists_view', - keys => 'view_ids', - values => 'get_views', - get => 'get_view', - set => 'add_view', + handles => { + exists_view => 'exists', + view_ids => 'keys', + get_views => 'values', + get_view => 'get', + add_view => 'set', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); has 'procedures' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef[Procedure], - provides => { - exists => 'exists_procedure', - keys => 'procedure_ids', - values => 'get_procedures', - get => 'get_procedure', - set => 'add_procedure', + handles => { + exists_procedure => 'exists', + procedure_ids => 'keys', + get_procedures => 'values', + get_procedure => 'get', + add_procedure => 'set', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); has 'triggers' => ( - metaclass => 'Collection::Hash', + traits => ['Hash'], is => 'rw', isa => HashRef[Trigger], - provides => { - exists => 'exists_trigger', - keys => 'trigger_ids', - values => 'get_triggers', - get => 'get_trigger', - set => 'add_trigger', + handles => { + exists_trigger => 'exists', + trigger_ids => 'keys', + get_triggers => 'values', + get_trigger => 'get', + add_trigger => 'set', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); diff --git a/lib/SQL/Translator/Object/Trigger.pm b/lib/SQL/Translator/Object/Trigger.pm index 3439694..ca4507b 100644 --- a/lib/SQL/Translator/Object/Trigger.pm +++ b/lib/SQL/Translator/Object/Trigger.pm @@ -1,7 +1,6 @@ use MooseX::Declare; class SQL::Translator::Object::Trigger extends SQL::Translator::Object { use MooseX::Types::Moose qw(Any ArrayRef HashRef Str); - use MooseX::AttributeHelpers; use SQL::Translator::Types qw(Column); has 'name' => ( @@ -11,15 +10,15 @@ class SQL::Translator::Object::Trigger 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 }, ); diff --git a/lib/SQL/Translator/Object/View.pm b/lib/SQL/Translator/Object/View.pm index 5d15b88..d77f747 100644 --- a/lib/SQL/Translator/Object/View.pm +++ b/lib/SQL/Translator/Object/View.pm @@ -1,7 +1,6 @@ use MooseX::Declare; class SQL::Translator::Object::View extends SQL::Translator::Object { use MooseX::Types::Moose qw(HashRef Str); - use MooseX::AttributeHelpers; use SQL::Translator::Types qw(Column); has 'name' => ( @@ -11,15 +10,15 @@ class SQL::Translator::Object::View 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 }, );