From: Rafael Kitover Date: Wed, 6 May 2009 03:25:04 +0000 (+0000) Subject: Replicated - fixup types and namespace::clean X-Git-Tag: v0.08103~83^2~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=41916570b3a93b05746e23b73c9a9b5005bc0d2e;p=dbsrgits%2FDBIx-Class.git Replicated - fixup types and namespace::clean --- diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index a25b2a4..a241ff4 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -29,6 +29,7 @@ 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 MooseX::Types::Moose qw/ClassName HashRef Object/; use namespace::clean -except => 'meta'; @@ -136,7 +137,7 @@ to: L. has 'pool_type' => ( is=>'ro', - isa=>'ClassName', + isa=>ClassName, required=>1, default=>'DBIx::Class::Storage::DBI::Replicated::Pool', handles=>{ @@ -153,7 +154,7 @@ See L for available arguments. has 'pool_args' => ( is=>'ro', - isa=>'HashRef', + isa=>HashRef, lazy=>1, required=>1, default=>sub { {} }, @@ -187,7 +188,7 @@ See L for available arguments. has 'balancer_args' => ( is=>'ro', - isa=>'HashRef', + isa=>HashRef, lazy=>1, required=>1, default=>sub { {} }, @@ -254,7 +255,7 @@ Defines an object that implements the read side of L. has 'read_handler' => ( is=>'rw', - isa=>'Object', + isa=>Object, lazy_build=>1, handles=>[qw/ select @@ -271,7 +272,7 @@ Defines an object that implements the write side of L. has 'write_handler' => ( is=>'ro', - isa=>'Object', + isa=>Object, lazy_build=>1, lazy_build=>1, handles=>[qw/ diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm index 8af899c..798c0ef 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Balancer.pm @@ -2,6 +2,9 @@ package DBIx::Class::Storage::DBI::Replicated::Balancer; use Moose::Role; requires 'next_storage'; +use MooseX::Types::Moose qw/Int/; + +use namespace::clean -except => 'meta'; =head1 NAME @@ -31,7 +34,7 @@ validating every query. has 'auto_validate_every' => ( is=>'rw', - isa=>'Int', + isa=>Int, predicate=>'has_auto_validate_every', ); diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm index e8fa630..b230346 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/First.pm @@ -2,6 +2,7 @@ package DBIx::Class::Storage::DBI::Replicated::Balancer::First; use Moose; with 'DBIx::Class::Storage::DBI::Replicated::Balancer'; +use namespace::clean -except => 'meta'; =head1 NAME @@ -50,4 +51,4 @@ You may distribute this code under the same terms as Perl itself. __PACKAGE__->meta->make_immutable; -1; \ No newline at end of file +1; diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm index 6f786d3..1e657b5 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Balancer/Random.pm @@ -2,6 +2,7 @@ package DBIx::Class::Storage::DBI::Replicated::Balancer::Random; use Moose; with 'DBIx::Class::Storage::DBI::Replicated::Balancer'; +use namespace::clean -except => 'meta'; =head1 NAME @@ -59,4 +60,4 @@ You may distribute this code under the same terms as Perl itself. __PACKAGE__->meta->make_immutable; -1; \ No newline at end of file +1; diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm index 15be166..aa3d7fc 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm @@ -6,6 +6,7 @@ use DBIx::Class::Storage::DBI::Replicated::Replicant; use List::Util 'sum'; use Scalar::Util 'reftype'; use Carp::Clan qw/^DBIx::Class/; +use MooseX::Types::Moose qw/Num Int ClassName HashRef/; use namespace::clean -except => 'meta'; @@ -41,7 +42,7 @@ return a number of seconds that the replicating database is lagging. has 'maximum_lag' => ( is=>'rw', - isa=>'Num', + isa=>Num, required=>1, lazy=>1, default=>0, @@ -57,7 +58,7 @@ builtin. has 'last_validated' => ( is=>'rw', - isa=>'Int', + isa=>Int, reader=>'last_validated', writer=>'_last_validated', lazy=>1, @@ -74,7 +75,7 @@ just leave this alone. has 'replicant_type' => ( is=>'ro', - isa=>'ClassName', + isa=>ClassName, required=>1, default=>'DBIx::Class::Storage::DBI', handles=>{ @@ -124,7 +125,7 @@ removes the replicant under $key from the pool has 'replicants' => ( is=>'rw', metaclass => 'Collection::Hash', - isa=>'HashRef[DBIx::Class::Storage::DBI]', + isa=>HashRef['DBIx::Class::Storage::DBI'], default=>sub {{}}, provides => { 'set' => 'set_replicant', diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm index e9612f3..9e32ca3 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm @@ -2,6 +2,9 @@ package DBIx::Class::Storage::DBI::Replicated::Replicant; use Moose::Role; requires qw/_query_start/; +use MooseX::Types::Moose qw/Bool/; + +use namespace::clean -except => 'meta'; =head1 NAME @@ -42,7 +45,7 @@ storage driver for more information. has 'active' => ( is=>'rw', - isa=>'Bool', + isa=>Bool, lazy=>1, required=>1, default=>1, @@ -88,4 +91,4 @@ You may distribute this code under the same terms as Perl itself. =cut -1; \ No newline at end of file +1; diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm index 2595516..f14b95c 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Types.pm @@ -5,6 +5,7 @@ use MooseX::Types use MooseX::Types::Moose qw/ClassName Str/; class_type 'DBIx::Class::Storage::DBI'; +class_type 'DBIx::Class::Schema'; subtype BalancerClassNamePart, as ClassName;