File Coverage

blib/lib/AnyEvent/Gearman/Types.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package AnyEvent::Gearman::Types;
2 6     6   41 use Any::Moose;
  6         14  
  6         43  
3 6     6   6126 use Any::Moose '::Util::TypeConstraints';
  6         17  
  6         31  
4              
5             subtype 'AnyEvent::Gearman::Client::Connections'
6             => as 'ArrayRef[AnyEvent::Gearman::Client::Connection]';
7              
8             subtype 'AnyEvent::Gearman::Client::StrConnections'
9             => as 'ArrayRef[Str]';
10              
11             coerce 'AnyEvent::Gearman::Client::Connections'
12             => from 'AnyEvent::Gearman::Client::StrConnections' => via {
13             for my $con (@$_) {
14             next if ref($con) and $con->isa('AnyEvent::Gearman::Client::Connection');
15             $con = AnyEvent::Gearman::Client::Connection->new( hostspec => $con );
16             }
17             $_;
18             };
19              
20             subtype 'AnyEvent::Gearman::Worker::Connections'
21             => as 'ArrayRef[AnyEvent::Gearman::Worker::Connection]';
22              
23             subtype 'AnyEvent::Gearman::Worker::StrConnections'
24             => as 'ArrayRef[Str]';
25              
26             coerce 'AnyEvent::Gearman::Worker::Connections'
27             => from 'AnyEvent::Gearman::Worker::StrConnections' => via {
28             for my $con (@$_) {
29             next if ref($con) and $con->isa('AnyEvent::Gearman::Worker::Connection');
30             $con = AnyEvent::Gearman::Worker::Connection->new( hostspec => $con );
31             }
32             $_;
33             };
34              
35             1;
36              
37             __END__