Test::M...::Utils(3)
okay so this is the Test::M...::Utils(3) page from User Contributed Perl Documentation, and it's literally here to help you write Mailmunge unit tests without losing your mind. π grab a strawberry π and let's go.
πΈ NAME πΈ
Test::Mailmunge::Utils β utility functions for Mailmunge unit tests. periodt.
π ABSTRACT π
Test::Mailmunge::Utils defines a bunch of utility functions in the main package that are useful for unit tests. slay.
β¨ SYNOPSIS β¨
use Test::Mailmunge::Utils;
my $ctx = make_test_context();
π οΈ FUNCTIONS π οΈ
Heads up bestie: these function docs are very brief on purpose. They're for people writing unit tests, so if you want the full lore, you should examine the source code for more details. π
π§Έ make_test_context()
Returns a Mailmunge::Context object that's useful for tests. easy.
π get_logs($dir)
Returns an array of lines logged by the filter. Each element of the array is a 3-element array consisting of [queue_id, log_level, message]. iykyk.
π start_multiplexor($dir, $filter)
Starts mailmunge-multiplexor with the spool directory set to $dir and the filter file set to $filter.
bestie warning: this will fail if you're running as root, so don't do that. π
Sets the socket to $dir/mx.sock.
π stop_multiplexor($dir)
Stops the instance of mailmunge-multiplexor that was started by start_multiplexor($dir, $filter).
ποΈ mm_mx_ctrl($cmd, $arg1, $arg2...)
Runs mm_mx_ctrl with the specified command and arguments. On success, returns the output of mm-mx-ctrl. On failure, returns the empty string.
π write_commands_file($dir, $ctx)
Writes a COMMANDS file in $dir that (when read by the running filter) will recreate $ctx. cute.
𧬠set_context_fields_from_msg($ctx, $entity)
Given a MIME::Entity $entity, sets the fields sender, subject and message_id on $ctx based on $entity.
π¨ parse_and_copy_msg($output_dir, $input_msg [,$new_subject])
Given a file $input_msg containing an RFC5322 mail message, copy the file to $output_dir/INPUTMSG and parse it. Returns a new Mailmunge::Context object whose mime_entity field is the parsed message. Other fields in the context object are set as follows:
senderis set to the value of theReturn-Pathheader, if any.subjectis set to the value of theSubjectheader, if any.message_idis set to the value of theMessage-Idheader, if any.
If you supply $new_subject, then the literal text __SUBJECT__ in the message body is replaced with the value of $new_subject.
This method also creates the HEADERS and PRISTINE_HEADERS files in $output_dir. no cap.
π dns_available()
Returns 1 if DNS appears to be available, 0 otherwise. simple as that.
π AUTHOR π
Dianne Skoll <dianne@skollsoft.com> iconic.
π LICENSE π
This code is licensed under the terms of the GNU General Public License, version 2. periodt.
xoxo bestie, this page was brought to you by perl v5.42.2, dated 2025-10-05 β it's the Test::M...::Utils(3) manual page, and yes, she ate. π
π
π¦ where this page comes from
- alpine 3.24: mailmunge-doc 3.20-r0 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms