Port ::Replicated from Moose to Moo+Type::Tiny
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Replicated / Balancer.pm
index aec2ec1..8226ff7 100644 (file)
@@ -1,11 +1,13 @@
 package DBIx::Class::Storage::DBI::Replicated::Balancer;
 
-use Moose::Role;
+use Moo::Role;
 requires 'next_storage';
-use MooseX::Types::Moose qw/Int/;
+use Types::Standard qw/Int/;
+use Type::Utils qw/class_type/;
+use Scalar::Util qw/blessed/;
 use DBIx::Class::Storage::DBI::Replicated::Pool;
 use DBIx::Class::Storage::DBI::Replicated::Types qw/DBICStorageDBI/;
-use namespace::clean -except => 'meta';
+use namespace::clean;
 
 =head1 NAME
 
@@ -63,7 +65,7 @@ balance.
 
 has 'pool' => (
   is=>'ro',
-  isa=>'DBIx::Class::Storage::DBI::Replicated::Pool',
+  isa=>class_type('DBIx::Class::Storage::DBI::Replicated::Pool'),
   required=>1,
 );
 
@@ -83,7 +85,10 @@ via its balancer object.
 has 'current_replicant' => (
   is=> 'rw',
   isa=>DBICStorageDBI,
-  lazy_build=>1,
+  lazy=>1,
+  builder=>1,
+  predicate=>1,
+  clearer=>1,
   handles=>[qw/
     select
     select_single
@@ -97,7 +102,7 @@ This class defines the following methods.
 
 =head2 _build_current_replicant
 
-Lazy builder for the L</current_replicant_storage> attribute.
+Lazy builder for the L</current_replicant> attribute.
 
 =cut
 
@@ -124,7 +129,7 @@ Advice on next storage to add the autovalidation.  We have this broken out so
 that it's easier to break out the auto validation into a role.
 
 This also returns the master in the case that none of the replicants are active
-or just just forgot to create them :)
+or just forgot to create them :)
 
 =cut
 
@@ -243,13 +248,16 @@ sub _get_forced_pool {
   }
 }
 
-=head1 AUTHOR
+=head1 FURTHER QUESTIONS?
 
-John Napiorkowski <jjnapiork@cpan.org>
+Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
 
-=head1 LICENSE
+=head1 COPYRIGHT AND LICENSE
 
-You may distribute this code under the same terms as Perl itself.
+This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
+by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
+redistribute it and/or modify it under the same terms as the
+L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
 
 =cut