Permalink
Browse files

rename attr to filter_body in Filter so that filtering can be applied…

… to filters
  • Loading branch information...
1 parent 3b8116b commit d803146984db2fa19193261c26fae22f51a64d7a @nothingmuch nothingmuch committed Sep 15, 2008
Showing with 5 additions and 3 deletions.
  1. +2 −2 lib/Data/Stream/Bulk/Filter.pm
  2. +3 −1 t/basic.t
@@ -9,7 +9,7 @@ use namespace::clean -except => 'meta';
has filter => (
isa => "CodeRef",
- is => "ro",
+ reader => "filter_body",
required => 1,
);
@@ -26,7 +26,7 @@ sub next {
my $self = shift;
local $_ = $self->stream->next;
- return $_ && ( $self->filter->($_) || [] );
+ return $_ && ( $self->filter_body->($_) || [] );
}
__PACKAGE__->meta->make_immutable;
View
@@ -193,11 +193,13 @@ use ok 'Data::Stream::Bulk::Util' => qw(bulk nil cat filter unique);
}
{
- my @array = ( [qw(foo bar)], [qw(gorch baz)] );
+ my @array = ( [qw(foo bar), "", ], [qw(gorch baz)] );
my $cb = sub { shift @array };
my $d = Data::Stream::Bulk::Callback->new( callback => $cb )->filter(sub {
+ return [ grep { length } @$_ ];
+ })->filter(sub{
return [ grep { /o/ } @$_ ];
});

0 comments on commit d803146

Please sign in to comment.