From 791b89f2b3d2ebdab4311ba2a60caf1be96d3466 Mon Sep 17 00:00:00 2001 From: Shawn M Moore Date: Thu, 27 Jun 2013 13:32:14 -0400 Subject: _concatenate_plugin for returning all plugins' return values in a list --- lib/Reply.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/Reply.pm b/lib/Reply.pm index bb72149..d5a3d4d 100644 --- a/lib/Reply.pm +++ b/lib/Reply.pm @@ -283,6 +283,22 @@ sub _chained_plugin { return @args; } +sub _concatenate_plugin { + my $self = shift; + my @plugins = ref($_[0]) ? @{ shift() } : $self->_plugins; + my ($method, @args) = @_; + + @plugins = grep { $_->can($method) } @plugins; + + my @results; + + for my $plugin (@plugins) { + push @results, $plugin->$method(@args); + } + + return @results; +} + =head1 BUGS No known bugs. -- cgit v1.2.3-54-g00ecf