make Types to avoid Copy/Pasting them
Arthur Axel 'fREW' Schmidt [Sun, 21 Mar 2010 05:07:44 +0000 (00:07 -0500)]
lib/DBIx/Class/DeploymentHandler.pm
lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm
lib/DBIx/Class/DeploymentHandler/Types.pm [new file with mode: 0644]

index 5deb9c6..076d294 100644 (file)
@@ -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',
index 5ec655e..7973095 100644 (file)
@@ -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 (file)
index 0000000..3878c9f
--- /dev/null
@@ -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;