.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::MtPolicyd::Request 3pm" .TH Mail::MtPolicyd::Request 3pm "2022-10-15" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mail::MtPolicyd::Request \- the request object .SH "VERSION" .IX Header "VERSION" version 2.05 .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "attributes" .IX Subsection "attributes" Contains an HashRef with all attributes of the request. .PP To retrieve a single attribute the attr method could be used: .PP .Vb 1 \& $obj\->attr(\*(Aqsender\*(Aq); .Ve .SS "session" .IX Subsection "session" Contains a HashRef with all values stored in the session. .PP mtpolicyd will persist the content of this HashRef across requests with the same instance_id. .SS "server" .IX Subsection "server" Contains the Net::Server object of mtpolicyd. .SS "type" .IX Subsection "type" The type of the request. Postfix will always use 'smtpd_access_policy'. .SS "use_caching" .IX Subsection "use_caching" Could be used to disable caching. Only used within the unit tests. .SH "METHODS" .IX Header "METHODS" .SS "dump_attr" .IX Subsection "dump_attr" Returns an string to dump the content of a request. .SS "get($variable_name)" .IX Subsection "get($variable_name)" Retrieve value of a session or request variable. .PP The format for the variable name is .PP .Vb 1 \& (:)? .Ve .PP If no scope is given it default to the request scope. .PP Valid scopes are: .IP "session, s" 4 .IX Item "session, s" Session variables. .IP "request, r" 4 .IX Item "request, r" Request attributes. .PP For example: .PP .Vb 3 \& $r\->get(\*(Aqrequest:sender\*(Aq); # retrieve sender from request \& $r\->get(\*(Aqr:sender\*(Aq); # short format \& $r\->get(\*(Aqsender\*(Aq); # scope defaults to request \& \& $r\->get(\*(Aqsession:user_policy\*(Aq); # retrieve session variable user_policy \& $r\->get(\*(Aqs:user_policy\*(Aq); # the same .Ve .SS "new_from_fh($fh)" .IX Subsection "new_from_fh($fh)" An object constructor for creating an request object with the content read for the supplied filehandle \f(CW$fh\fR. .PP Will die if am error ocours: .IP "error parsing request" 4 .IX Item "error parsing request" A line in the request could not be parsed. .IP "while reading request: " 4 .IX Item "while reading request: " The filehandle had an error while reading the request. .IP "connection closed by peer" 4 .IX Item "connection closed by peer" Connection has been closed while reading the request. .IP "could not parse request" 4 .IX Item "could not parse request" The client did not send a complete request. .ie n .SS "do_cached( $key, $sub )" .el .SS "do_cached( \f(CW$key\fP, \f(CW$sub\fP )" .IX Subsection "do_cached( $key, $sub )" This method will execute the function reference give in \f(CW$sub\fR and store the return values in \f(CW$key\fR within the session. If there is already a cached result stored within \f(CW$key\fR of the session it will return the content instead of calling the reference again. .PP Returns an Array with the return values of the function call. .PP Example: .PP .Vb 2 \& my ( $ip_result, $info ) = $r\->do_cached(\*(Aqrbl\-\*(Aq.$self\->name.\*(Aq\-result\*(Aq, \& sub { $self\->_rbl\->check( $ip ) } ); .Ve .ie n .SS "is_already_done( $key )" .el .SS "is_already_done( \f(CW$key\fP )" .IX Subsection "is_already_done( $key )" This function will raise an flag with name of \f(CW$key\fR within the session and return true if the flag is already set. False otherwise. .PP This could be used to prevent scores or headers from being applied a second time. .PP Example: .PP .Vb 3 \& if( defined $self\->score && ! $r\->is_already_done(\*(Aqrbl\-\*(Aq.$self\->name.\*(Aq\-score\*(Aq) ) { \& $self\->add_score($r, $self\->name => $self\->score); \& } .Ve .SS "is_attr_defined" .IX Subsection "is_attr_defined" Returns true if all given attribute names are defined and non-empty. .SH "AUTHOR" .IX Header "AUTHOR" Markus Benning .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2014 by Markus Benning . .PP This is free software, licensed under: .PP .Vb 1 \& The GNU General Public License, Version 2, June 1991 .Ve