line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Filter::T; |
2
|
2
|
|
|
2
|
|
1391
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
3
|
2
|
|
|
2
|
|
637
|
use MooX::Types::MooseLike::Base qw/ ArrayRef /; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
134
|
|
4
|
2
|
|
|
2
|
|
10
|
use namespace::clean -except => 'meta'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
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
|
417
|
my ($self, $message) = @_; |
17
|
2
|
|
|
|
|
5
|
foreach my $output_to (@{ $self->output_to }) { |
|
2
|
|
|
|
|
11
|
|
18
|
3
|
|
|
|
|
152
|
$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 |