DOKK / manpages / debian 12 / mtpolicyd / Mail::MtPolicyd::Request.3pm.en
Mail::MtPolicyd::Request(3pm) User Contributed Perl Documentation Mail::MtPolicyd::Request(3pm)

Mail::MtPolicyd::Request - the request object

version 2.05

Contains an HashRef with all attributes of the request.

To retrieve a single attribute the attr method could be used:

  $obj->attr('sender');

Contains a HashRef with all values stored in the session.

mtpolicyd will persist the content of this HashRef across requests with the same instance_id.

Contains the Net::Server object of mtpolicyd.

The type of the request. Postfix will always use 'smtpd_access_policy'.

Could be used to disable caching. Only used within the unit tests.

Returns an string to dump the content of a request.

Retrieve value of a session or request variable.

The format for the variable name is

  (<scope>:)?<variable>

If no scope is given it default to the request scope.

Valid scopes are:

Session variables.
Request attributes.

For example:

  $r->get('request:sender'); # retrieve sender from request
  $r->get('r:sender');       # short format
  $r->get('sender');         # scope defaults to request
  $r->get('session:user_policy'); # retrieve session variable user_policy
  $r->get('s:user_policy');       # the same

An object constructor for creating an request object with the content read for the supplied filehandle $fh.

Will die if am error ocours:

A line in the request could not be parsed.
The filehandle had an error while reading the request.
Connection has been closed while reading the request.
The client did not send a complete request.

This method will execute the function reference give in $sub and store the return values in $key within the session. If there is already a cached result stored within $key of the session it will return the content instead of calling the reference again.

Returns an Array with the return values of the function call.

Example:

  my ( $ip_result, $info ) = $r->do_cached('rbl-'.$self->name.'-result',
    sub { $self->_rbl->check( $ip ) } );

This function will raise an flag with name of $key within the session and return true if the flag is already set. False otherwise.

This could be used to prevent scores or headers from being applied a second time.

Example:

  if( defined $self->score && ! $r->is_already_done('rbl-'.$self->name.'-score') ) {
    $self->add_score($r, $self->name => $self->score);
  }

Returns true if all given attribute names are defined and non-empty.

Markus Benning <ich@markusbenning.de>

This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.

This is free software, licensed under:

  The GNU General Public License, Version 2, June 1991
2022-10-15 perl v5.34.0