Net::IMP::Filter(3)

NAME
Net::IMP::Filter - simple data filter using Net::IMP analyzers

SYNOPSIS
    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);
    ..

DESCRIPTION
"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):

out($self,$dir,$data)
    this gets called for output of data

deny($self,$msg,$dir)
    this gets called on IMP_DENY

fatal($self,$msg)
    this gets called on IMP_FATAL

log($self,$level,$msg,$dir,$offset,$len)
    this gets called on IMP_LOG

acctfld($self,$key,$value)
    this gets called on IMP_ACCTFIELD

To use the module the following subroutines are defined

new($class,$factory,%args)
    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.

in($self,$dir,$data,$type)
    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.

AUTHOR
Steffen Ullrich <sullr@cpan.org>

COPYRIGHT
Copyright by Steffen Ullrich.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.