[Mailmunge] Using $ctx globally.

list at ptld.com list at ptld.com
Tue Jul 30 18:40:50 EDT 2024


Can i map the $ctx object to a global reference? Will that work properly with mailmunge, not screw anything up, threading or whatnot? Is there a reason to advice against doing it this way? Just so i don't have to keep passing the $ctx along to all of the child subs from the filters.

   #!/usr/bin/env perl
   package Mailmunge::Policy;
   use strict;
   use warnings;

   our $ctx;

   sub filter_message {
     my ($self, $scoped_ctx) = @_;
     $ctx = $scoped_ctx;
     child_sub();
     return Mailmunge::Response->CONTINUE();
   }

   sub child_sub {
     $ctx->method();
     return;
   }



And in the last thread it was mentioned that the filters need to return with a response.

   sub filter_recipient {
     ...
     return Mailmunge::Response->CONTINUE();
   }

But i noticed i am not doing that in either filter_message{} or filter_wrapup{}. Neither of them even have a return; statement at the end, just a closing }. Should i add a return response to those filter subs?


More information about the Mailmunge mailing list