Dave Brondsema writes:
> I'm working on a plugin and need some advice for hooks.
> $plugin->check_post_dnsbl says "This is a good place to harvest your own
> asynchronously-started network lookups".  I'm using
> Mail::SpamAssassin::Plugin::Karmasphere as a reference, and it uses
> parsed_metadata() and check_post_dnsbl() to start and retrieve some
> network queries.  My plugin will do something very similar, but it
> relies on another plugin running first and it needs to only do the query
> if the first plugin sets a certain field on permsgstatus.  My problem is
> that the first plugin has not run when my parsed_metadata() executes, so
> I'm not sure the best place to initiate my network query.  Any suggestions?

In SpamAssassin 3.2.x, you can use register_method_priority() to set
the second plugin to always run after the first one (if it's loaded):


=item $plugin->register_method_priority($methodname, $priority)

Indicate that the method named C<$methodname> on the current object
has a callback priority of C<$priority>.

This is used by the plugin handler to determine the relative order of
callbacks; plugins with lower-numbered priorities are called before plugins
with higher-numbered priorities.  Each method can have a different priority
value.  The default value is C<0>.  The ordering of callbacks to methods with
equal priority is undefined.

Typically, you only need to worry about this if you need to ensure your
plugin's method is called before another plugin's implementation of that
method.  It should be called from your plugin's constructor.

This API was added in SpamAssassin 3.2.0.



Does that do the trick?

--j.

Reply via email to