minor replication changes - use a real hash merge, clarify master_read_weight, really...
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Replicated / Types.pm
CommitLineData
dcdf7b2c 1package # hide from PAUSE
2 DBIx::Class::Storage::DBI::Replicated::Types;
3
4=head1 NAME
5
6DBIx::Class::Storage::DBI::Replicated::Types - Types used internally by
7L<DBIx::Class::Storage::DBI::Replicated>
8
9=cut
9901aad7 10
11use MooseX::Types
ee356d00 12 -declare => [qw/BalancerClassNamePart Weight/];
13use MooseX::Types::Moose qw/ClassName Str Num/;
9901aad7 14
15class_type 'DBIx::Class::Storage::DBI';
41916570 16class_type 'DBIx::Class::Schema';
9901aad7 17
18subtype BalancerClassNamePart,
19 as ClassName;
20
21coerce BalancerClassNamePart,
22 from Str,
23 via {
24 my $type = $_;
25 if($type=~m/^::/) {
26 $type = 'DBIx::Class::Storage::DBI::Replicated::Balancer'.$type;
27 }
28 Class::MOP::load_class($type);
29 $type;
30 };
31
ee356d00 32subtype Weight,
33 as Num,
b88b85e7 34 where { $_ >= 0 },
35 message { 'weight must be a decimal greater than 0' };
ee356d00 36
dcdf7b2c 37=head1 AUTHOR
38
39 John Napiorkowski <john.napiorkowski@takkle.com>
40
41=head1 LICENSE
42
43You may distribute this code under the same terms as Perl itself.
44
45=cut
46
9901aad7 471;