package BlessedSub; use base 'Exporter'; @EXPORT = qw/blessed_sub/; ## prototyped for convenience sub blessed_sub(&) { my $anonymous_sub = shift; bless $anonymous_sub, __PACKAGE__; } sub filter { my ($self, @items) = @_; ## check if all the items return succesfully for (@items) { return 0 unless $self->($_); } return 1; }