File Coverage

blib/lib/Message/Passing/Filter/T.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 18 18 100.0


line stmt bran cond sub pod time code
1             package Message::Passing::Filter::T;
2 2     2   1354 use Moo;
  2         3  
  2         13  
3 2     2   674 use MooX::Types::MooseLike::Base qw/ ArrayRef /;
  2         3  
  2         226  
4 2     2   11 use namespace::clean -except => 'meta';
  2         4  
  2         18  
5              
6             with 'Message::Passing::Role::Input';
7             with 'Message::Passing::Role::Output';
8              
9             has '+output_to' => (
10             # isa => ArrayRef[role_type('Message::Passing::Role::Output')],
11             is => 'ro',
12             required => 1,
13             );
14              
15             sub consume {
16 2     2 1 516 my ($self, $message) = @_;
17 2         6 foreach my $output_to (@{ $self->output_to }) {
  2         12  
18 3         190 $output_to->consume($message);
19             }
20             }
21              
22              
23             1;
24              
25             =head1 NAME
26              
27             Message::Passing::Filter::T - Send a message stream to multiple outputs.
28              
29             =head1 DESCRIPTION
30              
31             This filter is used to duplicate a message stream to two or more outputs.
32              
33             All messages are duplicated to all output streams, so you may want to follow
34             this with L to one or more of those streams.
35              
36             =head1 ATTRIBUTES
37              
38             =head2 output_to
39              
40             Just like a normal L class, except takes an array of outputs.
41              
42             =head1 METHODS
43              
44             =head2 consume
45              
46             Sends the consumed message to all output_to instances.
47              
48             =head1 SPONSORSHIP
49              
50             This module exists due to the wonderful people at Suretec Systems Ltd.
51             who sponsored its development for its
52             VoIP division called SureVoIP for use with
53             the SureVoIP API -
54            
55              
56             =head1 AUTHOR, COPYRIGHT AND LICENSE
57              
58             See L.
59              
60             =cut