Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 8281
Status: resolved
Priority: 0/
Queue: POE

People
Owner: RCAPUTO [...] cpan.org
Requestors: martijn [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: POE::Filter::Stackable and get_one API
Attached patch brings Filter::Stackable into the get_one Filter API era
=== Stackable.pm ================================================================== --- Stackable.pm (/remote/poe/trunk/lib/POE/Filter) (revision 3246) +++ Stackable.pm (/local/poe/trunk/lib/POE/Filter) (revision 3246) @@ -33,6 +33,32 @@ #------------------------------------------------------------------------------ +sub get_one_start { + my ($self, $data) = @_; + + $self->[FILTERS]->[0]->get_one_start ($data); +} + +sub get_one { + my ($self) = @_; + + if (@{$self->[FILTERS]} == 1) { + return $self->[FILTERS]->[0]->get_one; + } + my $result = []; + for (my $i = 1; $i < @{$self->[FILTERS]}; $i++) { + my $last = $self->[FILTERS]->[$i - 1]; + my $this = $self->[FILTERS]->[$i]; + do { + my $data = $last->get_one; + last unless (@$data); + $this->get_one_start ($data); + $result = $this->get_one; + } until (@$result > 0); + } + return $result; +} + sub get { my ($self, $data) = @_; foreach my $filter (@{$self->[FILTERS]}) {
Thanks for the patch. It's applied even though there's no corresponding test.