Sorry to be a naysayer, but I would not put these on CPAN.
It's no problem at all. I am certainly not all gung-ho about putting these on CPAN. I just wanted to see if they'd make anyone else's life easier as they have for me.
Package::Require sounds like it is doing something that Perl already does for you. See the documentation for require, and look at %INC.
Not quite. First of all, I come across the
eval { require $somepm; }; quite often and the eval will be executed regardless of whether a module has already been required. This is slow.
Also, how often do you see the
$somepackage =~ s{::}{/}/g; come up? This module contains simple methods for going from a file to a package and vice versa and uses Memoize for speed.
Lastly, %INC doesn't record modules that it has already FAILED to require, but this module will handle that for you.
Package::Exporter does something you shouldn't want to do. Exporting functions without telling the user what you are exporting increases the odds of encountering software conflicts. Therefore a well-designed module should export as little as possible. (Exporter deliberately warns about this point for a reason.)
I tend to disagree because as a user of Package::Exporter, I'm at least somewhat aware that if I do
use Package qw/SomeModule/;then I'll be able to access all the subs in Package::SomeModule as just SomeModule.
The interface of all three of these modules is so minimal that there almost ISN'T an interface.
Your code example is not long enough to clarify what Package::Overridable does or how it is supposed to work. I tried to download it from your site so I could see for myself, but the connection timed out. However your reference in your comments to TestPackageOverridable and MyTestPackageOverridable suggests that the API is not one I'd like.
Package::Overridable basically provides an import sub to its children. So when a child class is imported, it will look in $PERL5LIB for a package of the same name but beginning with My. This makes it possible to transparently override code in development that will not be deployed to production because it's not under source control. I find this EXTREMELY handy.
In reply to Re^2: RFC: Some of my toolkit modules
by bennymack
in thread RFC: Some of my toolkit modules
by bennymack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |