mhonarc-dev

Suggestion: an <Extensions> resource

2002-09-12 17:17:20
MHA has two extension mechanisms (besides filters and charset converters):

1. Callbacks (CBMessageBodyRead, CBRcVarExpand, etc.)
2. mhasiteinit.pl

They both have problems:

1. You can register only one callback for each type.
2. You can have only one "mhasiteinit.pl".
3. Setting up "mhasiteinit.pl" may not be straightforward for the end user.

Let's examine the following true situation:

In HSMA I provided, as a bonus, a "mhasiteinit.pl" file that registers a 
CBRcVarExpand callback for those wishing to have a "Reply To" link in their 
pages (why I had to introduce a new resource variable, $X-MAILTOSUBJECT$, is 
a matter for a different discussion).

But the site in which MHA was installed already had a "mhasiteinit.pl" with 
its own callbacks.

Of course, these problems can be solved without modifying MHA: the user's code 
can first save the old callback address, install the new callback, and then 
each time the new callback runs it can execute the old saved callback. The 
"mhasiteinit.pl" singularity problem can be solved too.

But these problems can be solved elegantly in the MHA level:

1. Allow the user to register several callbacks of the same type. I.e., 
instead of:

    $mhonarc::CBRcVarExpand = \&my_callback_routine;

have:

    mhonarc::InstallRcVarExpandCallback(\&my_callback_routine);
    mhonarc::InstallRcVarExpandCallback(\&another_callback_routine);

2. Allow the user to list all the files he wants to "require" (that is, the 
Perl function "require") in the resource file; for example:

<Extensions>
SophisticatedEmailMangler.pl
MyDateFixer.pl
/path/to/hsma/lib/rcvariables.pl
</Extension>

When MHA starts it will require every file that is listed in the <Extensions> 
resource.


---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV

<Prev in Thread] Current Thread [Next in Thread>