From: John Napiorkowski Date: Fri, 10 Jul 2009 17:37:53 +0000 (+0000) Subject: a few more Moose Type related fixes and added diag to the replication test to report... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a151f5877412d2824295071428c52eb4bf646ec;p=dbsrgits%2FDBIx-Class-Historic.git a few more Moose Type related fixes and added diag to the replication test to report the moose and types version used, to help us debug some of the moose related errors being reported --- diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index 6302bf1..c583c6e 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -30,7 +30,7 @@ use Moose; use DBIx::Class::Storage::DBI; use DBIx::Class::Storage::DBI::Replicated::Pool; use DBIx::Class::Storage::DBI::Replicated::Balancer; -use DBIx::Class::Storage::DBI::Replicated::Types 'BalancerClassNamePart'; +use DBIx::Class::Storage::DBI::Replicated::Types qw/BalancerClassNamePart DBICSchema DBICStorageDBI/; use MooseX::Types::Moose qw/ClassName HashRef Object/; use Scalar::Util 'reftype'; use Carp::Clan qw/^DBIx::Class/; @@ -141,7 +141,7 @@ The underlying L object this storage is attaching has 'schema' => ( is=>'rw', - isa=>'DBIx::Class::Schema', + isa=>DBICSchema, weak_ref=>1, required=>1, ); @@ -254,7 +254,7 @@ pool of databases that is allowed to handle write traffic. has 'master' => ( is=> 'ro', - isa=>'DBIx::Class::Storage::DBI', + isa=>DBICStorageDBI, lazy_build=>1, ); diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm index a2d0fbc..d7a8769 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm @@ -3,7 +3,8 @@ package DBIx::Class::Storage::DBI::Replicated::Balancer; use Moose::Role; requires 'next_storage'; use MooseX::Types::Moose qw/Int/; - +use DBIx::Class::Storage::DBI::Replicated::Pool; +use DBIx::Class::Storage::DBI::Replicated::Types qw/DBICStorageDBI/; use namespace::clean -except => 'meta'; =head1 NAME @@ -48,7 +49,7 @@ ultimate fallback. has 'master' => ( is=>'ro', - isa=>'DBIx::Class::Storage::DBI', + isa=>DBICStorageDBI, required=>1, ); @@ -80,7 +81,7 @@ via it's balancer object. has 'current_replicant' => ( is=> 'rw', - isa=>'DBIx::Class::Storage::DBI', + isa=>DBICStorageDBI, lazy_build=>1, handles=>[qw/ select diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm index 7a1ba3e..4e75aa2 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm @@ -5,12 +5,15 @@ package # hide from PAUSE # L use MooseX::Types - -declare => [qw/BalancerClassNamePart Weight/]; + -declare => [qw/BalancerClassNamePart Weight DBICSchema DBICStorageDBI/]; use MooseX::Types::Moose qw/ClassName Str Num/; class_type 'DBIx::Class::Storage::DBI'; class_type 'DBIx::Class::Schema'; +subtype DBICSchema, as 'DBIx::Class::Schema'; +subtype DBICStorageDBI, as 'DBIx::Class::Storage::DBI'; + subtype BalancerClassNamePart, as ClassName; diff --git a/t/93storage_replication.t b/t/93storage_replication.t index f1743c5..65c236e 100644 --- a/t/93storage_replication.t +++ b/t/93storage_replication.t @@ -21,6 +21,10 @@ use_ok 'DBIx::Class::Storage::DBI::Replicated::Balancer'; use_ok 'DBIx::Class::Storage::DBI::Replicated::Replicant'; use_ok 'DBIx::Class::Storage::DBI::Replicated'; +use Moose(); +use MooseX::Types(); +diag "Using Moose version $Moose::VERSION and MooseX::Types version $MooseX::Types::VERSION"; + =head1 HOW TO USE This is a test of the replicated storage system. This will work in one of