| Devel-Events documentation | Contained in the Devel-Events distribution. |
Devel::Events::Filter::Callback - Callback based Devel::Events::Filter
use Devel::Events::Filter::Callback;
Devel::Events::Filter::Callback->new(
callback => sub {
my ( @event ) = @_;
return if bad_event(@event); # drop it
return map { filter($_) } @event; # change it
},
handler => $handler,
);
Duh.
a code ref
Delegates to callback
| Devel-Events documentation | Contained in the Devel-Events distribution. |
#!/usr/bin/perl package Devel::Events::Filter::Callback; use Moose; with qw/Devel::Events::Filter/; has callback => ( isa => "CodeRef", is => "rw", required => 1, ); sub filter_event { my ( $self, @event ) = @_; $self->callback->(@event); } __PACKAGE__; __END__