Algorithm-CheckDigits
view release on metacpan or search on metacpan
lib/Algorithm/CheckDigits.pm view on Meta::CPAN
Brian T. Wightman was the first, asking me to add a plugin registry to
Algorithm::CheckDigits and so I added the function C<plug_in()> that does just
this, registering plug in modules to be used just like the modules in the
distribution of this module.
Providing some means to add additional algorithms without the need to change
the module has the benefit that the user of those additional algorithms may
easily use them with the same interface as the other algorithms without having
to wait for a new version, that may or may not include the wanted algorithm.
But there is a problem: the user must be able to select the new algorithms
like he did with the other ones. And the catch is: since these new algorithms
are developed independently there is no guarantee that no more than one
module applies for the same handle. I could have implemented some simple
strategies like last one wins (the module that registers last for a given
handle is the one that is choosen) or first one wins (the first registered
module is choosen). Instead I went for something more complex to assure that
every module that wants to get registered will be registered and that every
registered module will be accessible by the same handle as long as the program
runs. To make this work C<plug_in()> sees the third argument only as a hint
how the handle should look like, when a module is registered. It returns the
( run in 1.088 second using v1.01-cache-2.11-cpan-49f99fa48dc )