NAME

Mail::IspMailGate::Filter::Packer - Compressing emails

SYNOPSIS

 # Create a Packer object for compression
 my($packer) = Mail::IspMailGate::Filter::Packer->new({
     'packer' => 'gzip',
     'direction' => 'pos'
 });

 # Create a Packer object for decompression
 my($packer) = Mail::IspMailGate::Filter::Packer->new({
     'packer' => 'gzip',
     'direction' => 'neg'
 });

 # Create a Packer object for automatic compression/decompression
 my($packer) = Mail::IspMailGate::Filter::Packer->new({
     'packer' => 'gzip'
 });

 # Call the filter
 my($res) = $packer->doFilter({
     'entity' => $entity,  # the MIME::Entity which is to be filtered
     'parser' => $parser
 });

VERSION AND VOLATILITY

    $Revision 1.0 $
    $Date 1998/04/05 18:46:12 $

DESCRIPTION

This class is the Packer (compressing emails) derived from Mail::IspMailGate::Filter (refer to the manpage). You can specify the attribute 'direction' with the constructor, so you can force to act only in one direction: 'pos' only compressing and 'neg' only for decompressing. If you specify no direction it will be guessed in the function mustFilter. If the message has never been Filter by Packer it chooses 'pos', else it checks in which direction this has happened and chooses the opposite. You can also specify the attribute 'packer' in the constructor to set the comressor type for direction 'pos'. The supported packer are configured in $cfg-{'packer'}> in each direction with a template for the system() command. It overrides the function filterFile, mustFilter, hookFile and getSign.

PUBLIC INTERFACE

mustFilter ENTITY

It determines the direction as described in DESCRIPTION and stores it in $self->{'recDirection'}. If the direction is 'neg' it also tries to determine the packer which was used for the compressing to guarantee a correct decompressing. If this failes it returns 0 and the email will not be decompressed. The same happens if this obejct has the attribute 'direction' and this attribute equals the sign in the MIME-header which is set in hookFilter. The packer which is to use (if possible) is stored in $self->{'recPacker'}.

filterFile FILENAME

Does the (de)compressing of a part of the MIME-message depending on $self->{'recDirection'} and $self->{'recPacker'}.

hookFilter ENTITY

This function sets the direction in the header of the message as well which packer was used.

Additionaly we have the function:

sub setEncoding ATTR

Where the attribute 'direction' specifies in which direction Packer acts at the moment and 'head' is the head of a subpart of the whole entity. This function sets in 'head' the 'Content-Transfer-Encoding'. It is set to base64 if the direction is 'pos' else it restores the old one which is stored in 'X-ispMailGate-Packer-PEncoding'. If this cannot be determined we assume base64. It is called by the overriden filterFile to guarantee a correct encoding of the email.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 287:

=over without closing =back