1Mail::SPF::MacroString(U3s)er Contributed Perl DocumentatMiaoinl::SPF::MacroString(3)
2
3
4

NAME

6       Mail::SPF::MacroString - SPF record macro string class
7

SYNOPSIS

9   Providing the expansion context early
10           use Mail::SPF::MacroString;
11
12           my $macrostring = Mail::SPF::MacroString->new(
13               text    => '%{ir}.%{v}._spf.%{d2}',
14               server  => $server,
15               request => $request
16           );
17
18           my $expanded = $macrostring->expand;
19
20   Providing the expansion context late
21           use Mail::SPF::MacroString;
22
23           my $macrostring = Mail::SPF::MacroString->new(
24               text    => '%{ir}.%{v}._spf.%{d2}'
25           );
26
27           my $expanded1 = $macrostring->expand($server, $request1);
28
29           $macrostring->context($server, $request2);
30           my $expanded2 = $macrostring->expand;
31

DESCRIPTION

33       An object of class Mail::SPF::MacroString represents a macro string
34       that can be expanded to a plain string in the context of an SPF
35       request.
36
37   Constructor
38       The following constructor is provided:
39
40       new(%options): returns Mail::SPF::MacroString
41           Creates a new SPF record macro string object.
42
43           %options is a list of key/value pairs representing any of the
44           following options:
45
46           text
47               Required.  The unexpanded text of the new macro string.
48
49           server
50               The Mail::SPF::Server object that is to be used when expanding
51               the macro string.  A server object need not be attached
52               statically to the macro string; it can be specified dynamically
53               when calling the "expand" method.
54
55           request
56               The Mail::SPF::Request object that is to be used when expanding
57               the macro string.  A request object need not be attached
58               statically to the macro string; it can be specified dynamically
59               when calling the "expand" method.
60
61           is_explanation
62               A boolean denoting whether the macro string is an explanation
63               string obtained via an "exp" modifier.  If true, the "c", "r",
64               and "t" macros may appear in the macro string, otherwise they
65               may not, and if they do, a Mail::SPF::EInvalidMacro exception
66               will be thrown when the macro string is expanded.  Defaults to
67               false.
68
69   Instance methods
70       The following instance methods are provided:
71
72       text: returns string
73           Returns the unexpanded text of the macro string.
74
75       context($server, $request): throws Mail::SPF::EOptionRequired
76           Attaches the given Mail::SPF::Server and Mail::SPF::Request objects
77           as the context for the macro string.
78
79       expand: returns string; throws Mail::SPF::EMacroExpansionCtxRequired,
80       Mail::SPF::EInvalidMacroString, Mail::SPF::Result::PermError
81       expand($server, $request): returns string; throws
82       Mail::SPF::EMacroExpansionCtxRequired, Mail::SPF::EInvalidMacroString,
83       Mail::SPF::Result::PermError
84           Expands the text of the macro string using either the context
85           specified through an earlier call to the "context()" method, or the
86           given context, and returns the resulting string.  See RFC 4408, 8,
87           for how macros are expanded.
88
89       is_explanation: returns boolean
90           Returns true if the macro string is an explanation string obtained
91           via an "exp" modifier.  See the description of the "new"
92           constructor's "is_explanation" option.
93
94       stringify: returns string
95           Returns the expanded text of the macro string if a context is
96           attached to the object.  Returns the unexpanded text otherwise.
97           You can simply use a Mail::SPF::MacroString object as a string for
98           the same effect, see "OVERLOADING".
99

OVERLOADING

101       If a Mail::SPF::MacroString object is used as a string, the "stringify"
102       method is used to convert the object into a string.
103

SEE ALSO

105       Mail::SPF, Mail::SPF::Record, Mail::SPF::Server, Mail::SPF::Request
106
107       <http://tools.ietf.org/html/rfc4408>
108
109       For availability, support, and license information, see the README file
110       included with Mail::SPF.
111

AUTHORS

113       Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org>
114
115
116
117perl v5.32.0                      2020-07-28         Mail::SPF::MacroString(3)
Impressum