Mail::S...oString(3)

πŸ’– Mail::SPF::MacroString πŸ’–

okay bestie, so this page is the manual for Mail::SPF::MacroString and it comes to you from the User Contributed Perl Documentation collection ✨ like it literally lives in the perl man pages, that's its whole vibe 🫢


✨ VERSION ✨

This is version 3.20260331 β€” that's the one we're working with, no cap 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

🌈 Providing the expansion context early

use Mail::SPF::MacroString;

my $macrostring = Mail::SPF::MacroString->new(
    text    => '%{ir}.%{v}._spf.%{d2}',
    server  => $server,
    request => $request
);

my $expanded = $macrostring->expand;

🌈 Providing the expansion context late

use Mail::SPF::MacroString;

my $macrostring = Mail::SPF::MacroString->new(
    text    => '%{ir}.%{v}._spf.%{d2}'
);

my $expanded1 = $macrostring->expand($server, $request1);

$macrostring->context($server, $request2);
my $expanded2 = $macrostring->expand;

πŸ‘‘ DESCRIPTION πŸ‘‘

so a Mail::SPF::MacroString object is literally just a macro string β€” like, a string with macro stuff in it β€” and it can be expanded into a plain boring string in the context of an SPF request πŸ’… that's the whole assignment bestie


πŸŽ€ Constructor πŸŽ€

here's the constructor you get:

new(%options) β€” returns Mail::SPF::MacroString

creates a brand new SPF record macro string object ✨ iconic behavior honestly

%options is a list of key/value pairs, and it can be any of these lil guys:

  • text β€” Required, bestie, like you cannot skip this one. it's the unexpanded text of your new macro string πŸ’–
  • server β€” the Mail::SPF::Server object that gets used when the macro string is expanded. and no, a server object does not have to be attached statically to the macro string β€” you can totally specify it dynamically when you call the expand method πŸ¦‹
  • request β€” the Mail::SPF::Request object that gets used when the macro string is expanded. same deal: a request object does not need to be attached statically, you can specify it dynamically when you call expand 🌸
  • is_explanation β€” a boolean that says whether the macro string is an explanation string obtained via an exp modifier. if it's true, then the c, r, and t macros are allowed to show up in the macro string; if it's false, they are NOT allowed, and if they show up anyway a Mail::SPF::EInvalidMacro exception gets thrown when the macro string is expanded 😭 Defaults to false, periodt.

πŸ’œ Instance methods πŸ’œ

these are the instance methods you get:

text β€” returns string

returns the unexpanded text of the macro string, simple as 🫢

context($server, $request) β€” throws Mail::SPF::EOptionRequired

attaches the given Mail::SPF::Server and Mail::SPF::Request objects as the context for the macro string πŸ’…

expand β€” returns string; throws Mail::SPF::EMacroExpansionCtxRequired, Mail::SPF::EInvalidMacroString, Mail::SPF::Result::PermError

expand($server, $request) β€” returns string; throws Mail::SPF::EMacroExpansionCtxRequired, Mail::SPF::EInvalidMacroString, Mail::SPF::Result::PermError

expands the text of the macro string using either the context you set up earlier with a call to the context() method, or the context you're passing in right now, and hands you back the resulting string 🌟 and if you wanna know exactly how macros get expanded, go read RFC 4408, 8, it's all in there πŸ‘‘

is_explanation β€” returns boolean

returns true if the macro string is an explanation string obtained via an exp modifier ✨ (peep the description of the new constructor's is_explanation option for the tea)

stringify β€” returns string

returns the expanded text of the macro string if a context is attached to the object. returns the unexpanded text if there isn't one 🌈 and honestly? you can just use a Mail::SPF::MacroString object directly as a string for the exact same effect, see OVERLOADING below bestie πŸ’–


🌸 OVERLOADING 🌸

if you use a Mail::SPF::MacroString object as a string, the stringify method is what converts the object into a string ✨ that's it, that's the whole section πŸ’…


⭐ SEE ALSO ⭐

and for availability, support, and license info, go check the README file that ships with Mail::SPF πŸ“–


🌈 AUTHORS 🌈

Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org> 🫢


and that's the whole page babes πŸ’– this was perl v5.42.1, dated 2026-04-23, and it came to you as Mail::S...oString(3) from the User Contributed Perl Documentation β€” slay, go write some SPF records, i believe in you πŸ‘‘βœ¨

πŸ“¦ where this page comes from