From: Arthur Axel 'fREW' Schmidt Date: Sun, 21 Mar 2010 05:07:44 +0000 (-0500) Subject: make Types to avoid Copy/Pasting them X-Git-Tag: v0.001000_01~64 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=418634284e2fdd63bb846894cc628ae1a61a6765;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git make Types to avoid Copy/Pasting them --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index 5deb9c6..076d294 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -6,20 +6,11 @@ require DBIx::Class::Schema; # loaded for type constraint require DBIx::Class::ResultSet; # loaded for type constraint use Carp::Clan '^DBIx::Class::DeploymentHandler'; +use DBIx::Class::DeploymentHandler::Types; with 'DBIx::Class::DeploymentHandler::WithSqltDeployMethod', 'DBIx::Class::DeploymentHandler::WithDatabaseToSchemaVersions', 'DBIx::Class::DeploymentHandler::WithStandardVersionStorage'; -BEGIN { - use Moose::Util::TypeConstraints; - subtype 'DBIx::Class::DeploymentHandler::Databases' - => as 'ArrayRef[Str]'; - - coerce 'DBIx::Class::DeploymentHandler::Databases' - => from 'Str' - => via { [$_] }; - no Moose::Util::TypeConstraints; -} has schema => ( isa => 'DBIx::Class::Schema', diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 5ec655e..7973095 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -7,6 +7,8 @@ require SQL::Translator::Diff; require DBIx::Class::Storage; # loaded for type constraint use autodie; use File::Path; +use DBIx::Class::DeploymentHandler::Types; + with 'DBIx::Class::DeploymentHandler::HandlesDeploy'; diff --git a/lib/DBIx/Class/DeploymentHandler/Types.pm b/lib/DBIx/Class/DeploymentHandler/Types.pm new file mode 100644 index 0000000..3878c9f --- /dev/null +++ b/lib/DBIx/Class/DeploymentHandler/Types.pm @@ -0,0 +1,14 @@ +package DBIx::Class::DeploymentHandler::Types; +use strict; +use warnings; + +use Moose::Util::TypeConstraints; +subtype 'DBIx::Class::DeploymentHandler::Databases' + => as 'ArrayRef[Str]'; + +coerce 'DBIx::Class::DeploymentHandler::Databases' + => from 'Str' + => via { [$_] }; +no Moose::Util::TypeConstraints; + +1;