File Coverage

blib/lib/Message/Passing/Filter/Mangle.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Message::Passing::Filter::Mangle;
2 1     1   109705 use Moo;
  1         12234  
  1         5  
3 1     1   2145 use MooX::Types::MooseLike::Base qw/ CodeRef /;
  1         6860  
  1         81  
4 1     1   592 use namespace::clean -except => 'meta';
  1         11621  
  1         6  
5              
6             with 'Message::Passing::Role::Filter';
7              
8             has filter_function => (
9             isa => CodeRef,
10             is => 'ro',
11             required => 1,
12             );
13              
14             sub filter {
15 6     6 1 13 my $self = shift;
16              
17 6         20 return $self->filter_function->(@_);
18             }
19              
20             1;
21              
22             =head1 NAME
23              
24             Message::Passing::Filter::Mangle - Filter and/or mangle messages the way you
25             want.
26              
27             =head1 DESCRIPTION
28              
29             This filter takes a sub which is called with the same arguments as
30             L<Message::Passing::Role::Filter/filter> minus $self.
31              
32             It's intended for use with L<Message::Passing::DSL> when you don't want to write
33             a named filter.
34              
35             =head1 ATTRIBUTES
36              
37             =head2 filter_function
38              
39             =head1 METHODS
40              
41             =head2 filter
42              
43             Calls filter_function passing on all received arguments but $self.
44              
45             =head1 SPONSORSHIP
46              
47             This module exists due to the wonderful people at Suretec Systems Ltd.
48             <http://www.suretecsystems.com/> who sponsored its development for its
49             VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with
50             the SureVoIP API -
51             <http://www.surevoip.co.uk/support/wiki/api_documentation>
52              
53             =head1 AUTHOR, COPYRIGHT AND LICENSE
54              
55             See L<Message::Passing>.
56              
57             =cut