Filter::Util::Call

Provides a framework for implementing source filters in Perl code. While you may use Filter::Util::Call directly, we suggest you use Filter::Simple instead.

For example:

package Milter; # Could just as well be called 'OldJoke'
 
use Filter::Util::Call ;
 
sub import {
    my($type) = @_ ;
    filter_add(bless []) ;
}
 
sub filter {
    my($self) = @_;
    my($status);
       
    s/Shut-Up/Trouble/g
       
    if ($status = filter_read()) > 0;
    $status ;
 }
 1;

You’d use the above in your code like so:

#!/usr/local/bin/perl -w
use Milter;
print "Are you looking for Shut-Up?\n" ;

This prints:

Are you looking for Trouble?

Filter::Util::Call implements the following methods.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.