Skip Menu |
 

This queue is for tickets about the Algorithm-CheckDigits CPAN distribution.

Report information
The Basics
Id: 84769
Status: open
Priority: 0/
Queue: Algorithm-CheckDigits

People
Owner: mamawe [...] cpan.org
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: v1.2.1
Fixed in: (no value)



Subject: Add ability to plug other modules into Algorithm::CheckDigits framework
Download (untitled) / with headers
text/plain 376b
Sorry about the first post - browser / finger hiccup. At https://github.com/MidLifeXis/perl-algorithm-checkdigits/compare/plugin, you will find a proposed enhancement to allow other modules to plug into the Algorithm::CheckDigits framework. Would you be able to comment on the intent and implementation, and if you wish, apply the patch? Includes test files. Thanks, Brian
Subject: Correction to commit link
Download (untitled) / with headers
text/plain 616b
One more correction: https://github.com/MidLifeXis/perl-algorithm-checkdigits/commit/5aefd49a0cf4e291aaf61c9f99c97264629bb5f5 is the correct link to the commit. Brian On Sat Apr 20 16:08:17 2013, MLX wrote: Show quoted text
> Sorry about the first post - browser / finger hiccup. > > At https://github.com/MidLifeXis/perl-algorithm- > checkdigits/compare/plugin, you will find a proposed enhancement to > allow other modules to plug into the Algorithm::CheckDigits framework. > > Would you be able to comment on the intent and implementation, and if > you wish, apply the patch? > > Includes test files. > > Thanks, > Brian
Download (untitled) / with headers
text/plain 450b
Hello Brian, Show quoted text
> Would you be able to comment on the intent and implementation, and if > you wish, apply the patch?
thanks for your patch. A few weeks ago I thought about adding a plugin capability but had no time to think it through and implement it. Your plug_in() function seems perfect. I would suggest the namespace Algorithm::CheckDigits::Plugin for plugins by other authors on CPAN. That way they should be easier to find. Regards, Mathias
Download (untitled) / with headers
text/plain 680b
On Sat Apr 20 17:37:02 2013, MAMAWE wrote: Show quoted text
> I would suggest the namespace Algorithm::CheckDigits::Plugin for > plugins by other authors on CPAN. That way they should be easier to > find.
No problem at all with that. My intent was that what I have listed in the example as the ::Registry module would contain only the name to class mapping. I have seen the Module::Pluggable module (now core, I believe) in use with the ::Plugin suffix, and since the mechanism used is quite different, I intentionally tried to avoid that namespace. I am not adverse to the name for anything other than that reason. Do you want me to update the github repo, or do you want to do it? Brian
Download (untitled) / with headers
text/plain 401b
On Sat Apr 20 18:43:47 2013, MLX wrote: Show quoted text
> On Sat Apr 20 17:37:02 2013, MAMAWE wrote:
> > I would suggest the namespace Algorithm::CheckDigits::Plugin for > > plugins by other authors on CPAN. That way they should be easier to > > find.
> > [snip] > > Do you want me to update the github repo, or do you want to do it?
I have updated the examples and documentation to reflect your suggestion. Brian
Download (untitled) / with headers
text/plain 283b
On Sat Apr 20 20:35:47 2013, MLX wrote: Show quoted text
> I have updated the examples and documentation to reflect your suggestion.
There are some days I should just leave my tools on the table. Here is the link for the diff: https://github.com/MidLifeXis/perl-algorithm-checkdigits/compare/plugin
Download (untitled) / with headers
text/plain 761b
Having slept a night over the matter the following came to my mind this morning: Your plug_in() function could break existing code. Look at the attached example code and/or run it in the perl debugger. I think a better approach would be not to change the existing keys of %methods and instead have plug_in() return the key added. That would mean that you could only add one method per call to plug_in(). It would also mean that every plugged in module should provide one or more public variables that hold the keys with which the methods could be instantiated. I would like to take the discussion of this topic over to http://perlmonks.org/ to get some other opinions. It will take a few hours, since I have a few other commitments today. Regards, Mathias
Subject: hashadd.pl
Download hashadd.pl
text/x-perl 203b
#!/usr/bin/perl # vim: set ts=4 sw=4 tw=78 et si: my %methods; sub plug_in { %methods = ( %methods, @_ ); } plug_in( a => 'A', b => 'B', ); plug_in( b => 'C', d => 'D', ); exit;
Download (untitled) / with headers
text/plain 376b
On Sun Apr 21 03:49:50 2013, MAMAWE wrote: Show quoted text
> I would like to take the discussion of this topic over to > http://perlmonks.org/ to get some other opinions. > It will take a few hours, since I have a few other commitments today.
Sounds good. I actually was thinking about this when I was writing it. I have opened an SoPW: http://www.perlmonks.org/?node_id=1029751. Brian
Download (untitled) / with headers
text/plain 417b
I just uploaded Algorithm-CheckDigits-v1.3.0 to CPAN. It should be available soon. There are mainly two things changed: - The descriptions of the algorithms are (hopefully) slightly more meaningfull. - There is a plug_in() function to register plugin modules, together with some tests that should show how to use this. Could you please have a look if this is O.K. for you as it is or if something should be changed.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.