Net::IMP::Filter - simple data filter using Net::IMP analyzers
package myFilter; use base 'Net::IMP::Filter'; sub out { my ($self,$dir,$data) = @_; print "[$dir] $data\n"; } package main; use Net::IMP::Pattern; my $factory = Net::IMP::Pattern->new_factory...; my $f = myFilter->new( $factory->new_analyzer ); .. $f->in(0,$data0); $f->in(1,$data1); ..
Net::IMP::Filter
is a class which can be used for simple filters (e.g. data in, data out) using Net::IMP analyzers, thus hiding the complexity but also useful features of the Net::IMP interface for simple use cases. To create such a filter subclass from Net::IMP::Filter
and implement any of the following methods (which by default do nothing):
this gets called for output of data
this gets called on IMP_DENY
this gets called on IMP_FATAL
this gets called on IMP_LOG
this gets called on IMP_ACCTFIELD
To use the module the following subroutines are defined
This function creates a new filter object. %args
will be put as keys into the objects hash and thus be available to the methods described above.
This method puts new data $data
for direction $dir
with type $type
into the filter object, which will then send it to the analyzer and finally result in calls to out
, deny
, log
etc.
Steffen Ullrich <sullr@cpan.org>
Copyright by Steffen Ullrich.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.