[libmessage-passing-perl] 03/11: don't pass to Filter::Mangle's filter_function
Jonas Smedegaard
js at alioth.debian.org
Fri Aug 9 15:49:00 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libmessage-passing-perl.
commit 4255d7b698a875894783c0cb547668b469541685
Author: Alexander Hartmaier <abraxxa at cpan.org>
Date: Mon Jul 29 17:29:18 2013 +0200
don't pass to Filter::Mangle's filter_function
---
lib/Message/Passing/Filter/Mangle.pm | 8 +++++---
t/filter_mangle.t | 12 ++++--------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/lib/Message/Passing/Filter/Mangle.pm b/lib/Message/Passing/Filter/Mangle.pm
index 2070439..d4d8f41 100644
--- a/lib/Message/Passing/Filter/Mangle.pm
+++ b/lib/Message/Passing/Filter/Mangle.pm
@@ -12,7 +12,9 @@ has filter_function => (
);
sub filter {
- return shift->filter_function->(@_);
+ my $self = shift;
+
+ return $self->filter_function->(@_);
}
1;
@@ -25,7 +27,7 @@ want.
=head1 DESCRIPTION
This filter takes a sub which is called with the same arguments as
-L<Message::Passing::Role::Filter/filter>.
+L<Message::Passing::Role::Filter/filter> minus $self.
It's intended for use with L<Message::Passing::DSL> when you don't want to write
a named filter.
@@ -38,7 +40,7 @@ a named filter.
=head2 filter
-Calls filter_function passing on all received arguments.
+Calls filter_function passing on all received arguments but $self.
=head1 SPONSORSHIP
diff --git a/t/filter_mangle.t b/t/filter_mangle.t
index 2fb5a7d..cf02e75 100644
--- a/t/filter_mangle.t
+++ b/t/filter_mangle.t
@@ -9,18 +9,14 @@ use Message::Passing::Output::Test;
my @data = (
[ 'Passthrough filter of scalar messages',
sub {
- my ( $self, $message ) = @_;
-
- return $message;
+ return shift;
},
'test message',
'test message',
],
[ 'Passthrough filter of hashref message',
sub {
- my ( $self, $message ) = @_;
-
- return $message;
+ return shift;
},
{ message => 'test message' },
{ message => 'test message' },
@@ -41,7 +37,7 @@ my @data = (
],
[ 'Mangle filter of scalar messages',
sub {
- my ( $self, $message ) = @_;
+ my $message = shift;
return $message . ' from me';
},
@@ -50,7 +46,7 @@ my @data = (
],
[ 'Mangle filter of hashref message',
sub {
- my ( $self, $message ) = @_;
+ my $message = shift;
$message->{from} = 'me';
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmessage-passing-perl.git
More information about the Pkg-perl-cvs-commits
mailing list