From: Justin Hunter Date: Thu, 2 Jul 2009 13:53:43 +0000 (-0700) Subject: use Moose::Role gets accompanied with no Moose::Role X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=25cc6346d4bf94051a131b5067a26fdd5451c540;p=dbsrgits%2FSQL-Translator-2.0-ish.git use Moose::Role gets accompanied with no Moose::Role remove comments sub { undef } can just be undef --- diff --git a/lib/SQL/Translator/Parser/DBI.pm b/lib/SQL/Translator/Parser/DBI.pm index a4f43b3..96f25a1 100644 --- a/lib/SQL/Translator/Parser/DBI.pm +++ b/lib/SQL/Translator/Parser/DBI.pm @@ -28,20 +28,20 @@ has 'namesep' => ( has 'schema_name' => ( is => 'rw', isa => Maybe[Str], - required => 1, + required => 0, lazy => 1, - default => sub { undef } + default => undef ); has 'catalog_name' => ( is => 'rw', isa => Maybe[Str], - required => 1, + required => 0, lazy => 1, - default => sub { undef } + default => undef ); -no Moose; +no Moose::Role; sub _subclass { my $self = shift; @@ -84,7 +84,6 @@ sub _add_columns { default_value => $col_info->{COLUMN_DEF}, is_nullable => $col_info->{NULLABLE}, }); $table->add_column($column); - } } @@ -93,28 +92,10 @@ sub _add_primary_key { my $table = shift; my $pk_info = $self->dbh->primary_key_info($self->catalog_name, $self->schema_name, $table->name); -# use Data::Dumper; my ($pk_name, @pk_cols); while (my $pk_col = $pk_info->fetchrow_hashref) { $pk_name = $pk_col->{PK_NAME}; push @pk_cols, $pk_col->{COLUMN_NAME}; -# print Dumper($pk_col); -=cut -$VAR1 = { - 'PK_NAME' => 'tester_pkey', - 'pg_column' => 'tester_pkey', - 'pg_table' => 'tester', - 'COLUMN_NAME' => 'id', - 'pg_tablespace_name' => undef, - 'pg_tablespace_location' => undef, - 'TABLE_CAT' => undef, - 'TABLE_NAME' => 'tester', - 'DATA_TYPE' => 'int4', - 'pg_schema' => 'public', - 'TABLE_SCHEM' => 'public', - 'KEY_SEQ' => '1' - }; -=cut } my $index = SQL::Translator::Object::Index->new({ name => $pk_name, type => 'PRIMARY_KEY' }); $index->add_column($table->get_column($_)) for @pk_cols; diff --git a/lib/SQL/Translator/Parser/DBI/MySQL.pm b/lib/SQL/Translator/Parser/DBI/MySQL.pm index 0e8e163..60f65ea 100644 --- a/lib/SQL/Translator/Parser/DBI/MySQL.pm +++ b/lib/SQL/Translator/Parser/DBI/MySQL.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DBI::MySQL; use Moose::Role; -no Moose; +no Moose::Role; 1; diff --git a/lib/SQL/Translator/Parser/DBI/Oracle.pm b/lib/SQL/Translator/Parser/DBI/Oracle.pm index 8c91d3c..2d28060 100644 --- a/lib/SQL/Translator/Parser/DBI/Oracle.pm +++ b/lib/SQL/Translator/Parser/DBI/Oracle.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DBI::Oracle; use Moose::Role; -no Moose; +no Moose::Role; 1; diff --git a/lib/SQL/Translator/Parser/DBI/PostgreSQL.pm b/lib/SQL/Translator/Parser/DBI/PostgreSQL.pm index 8668a76..4f46d43 100644 --- a/lib/SQL/Translator/Parser/DBI/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/DBI/PostgreSQL.pm @@ -10,7 +10,7 @@ has 'schema_name' => ( default => 'public' ); -no Moose; +no Moose::Role; sub _get_view_sql { my $self = shift; diff --git a/lib/SQL/Translator/Parser/DBI/SQLite.pm b/lib/SQL/Translator/Parser/DBI/SQLite.pm index 41447c3..857566f 100644 --- a/lib/SQL/Translator/Parser/DBI/SQLite.pm +++ b/lib/SQL/Translator/Parser/DBI/SQLite.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DBI::SQLite; use Moose::Role; -no Moose; +no Moose::Role; 1; diff --git a/lib/SQL/Translator/Parser/DBI/Sybase.pm b/lib/SQL/Translator/Parser/DBI/Sybase.pm index 4d5bbc7..3c1d012 100644 --- a/lib/SQL/Translator/Parser/DBI/Sybase.pm +++ b/lib/SQL/Translator/Parser/DBI/Sybase.pm @@ -1,5 +1,6 @@ package SQL::Translator::Parser::DBI::Sybase; use Moose::Role; -no Moose; +no Moose::Role; + 1; diff --git a/lib/SQL/Translator/Parser/DDL.pm b/lib/SQL/Translator/Parser/DDL.pm index 55e10e7..8e8c2ad 100644 --- a/lib/SQL/Translator/Parser/DDL.pm +++ b/lib/SQL/Translator/Parser/DDL.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DDL; use Moose::Role; -no Moose; +no Moose::Role; 1; diff --git a/lib/SQL/Translator/Parser/DDL/MySQL.pm b/lib/SQL/Translator/Parser/DDL/MySQL.pm index ead0a85..91f2f74 100644 --- a/lib/SQL/Translator/Parser/DDL/MySQL.pm +++ b/lib/SQL/Translator/Parser/DDL/MySQL.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DDL::MySQL; use Moose::Role; -no Moose; +no Moose::Role; 1; diff --git a/lib/SQL/Translator/Parser/DDL/Oracle.pm b/lib/SQL/Translator/Parser/DDL/Oracle.pm index 78acc99..cee7a74 100644 --- a/lib/SQL/Translator/Parser/DDL/Oracle.pm +++ b/lib/SQL/Translator/Parser/DDL/Oracle.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DDL::Oracle; use Moose::Role; -no Moose; +no Moose::Role; 1; diff --git a/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm b/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm index caac905..8a52df7 100644 --- a/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DDL::PostgreSQL; use Moose::Role; -no Moose; +no Moose::Role; 1; diff --git a/lib/SQL/Translator/Parser/DDL/SQLite.pm b/lib/SQL/Translator/Parser/DDL/SQLite.pm index 843f8c9..c7ffe87 100644 --- a/lib/SQL/Translator/Parser/DDL/SQLite.pm +++ b/lib/SQL/Translator/Parser/DDL/SQLite.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DDL::SQLite; use Moose::Role; -no Moose; +no Moose::Role; 1; diff --git a/lib/SQL/Translator/Parser/DDL/Sybase.pm b/lib/SQL/Translator/Parser/DDL/Sybase.pm index 6235a25..126067d 100644 --- a/lib/SQL/Translator/Parser/DDL/Sybase.pm +++ b/lib/SQL/Translator/Parser/DDL/Sybase.pm @@ -1,6 +1,6 @@ package SQL::Translator::Parser::DDL::Sybase; use Moose::Role; -no Moose; +no Moose::Role; 1;