Passing/Filter/T.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 22 / 22 SCAR 6.9
CC
2
Cov
100%
consume
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Passing/Filter/Decoder/JSON.pm ↑ Summary Passing/Role/Filter.pm »
1 package Message::Passing::Filter::T;
2 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use MooX::Types::MooseLike::Base qw/ ArrayRef /;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 with 'Message::Passing::Role::Input';
7 2 with 'Message::Passing::Role::Output';
8  
9 2 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 ▶ my ($self, $message) = @_;
Subroutine consume: called CC=2 SCAR=6.9
Pod documented
17 2 foreach my $output_to (@{ $self->output_to }) {
18 3 $output_to->consume($message);
19 }
20 }
21  
22  
23 2 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<Message::Passing::Filter::Key> to one or more of those streams.
35  
36 =head1 ATTRIBUTES
37  
38 =head2 output_to
39  
40 Just like a normal L<Message::Passing::Role::Input> 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 <http://www.suretecsystems.com/> who sponsored its development for its
52 VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with
53 the SureVoIP API -
54 <http://www.surevoip.co.uk/support/wiki/api_documentation>
55  
56 =head1 AUTHOR, COPYRIGHT AND LICENSE
57  
58 See L<Message::Passing>.
59  
60 =cut
« Passing/Filter/Decoder/JSON.pm ↑ Summary Passing/Role/Filter.pm »