| Module Info
| Add a review of Xporter
Steve -- I wrote Xporter specifically because I didn't think Exporter had done the right thing.
Secondly, I can hardly see the worry for confusion, since the control of using Exporter or Xporter is up to the library-module writer -- and they can choose what interface to offer to the user -- Since how to use optional arguments in "use module(optional args), is always module specific, any exceptions to normal usage would be documented.
Should I be confused when (:xxyz) doesn't work on some module? i.e.
what you put after "use mod" is highly module dependent.
Third minor nit, it's trivial enough to eliminate the defaults
use mod([!|-] <other options>); Using ! or - by themselves negates the default (as one might expect).
Neither of those issues covers the fact that with Exporter, you must explicitly include it in your @ISA for it to work (or import it's methods). Why put such a bother on all users when it's the normal case? -- I.e. In a non-OO module, why shouldn't adding to the @ISA of the calling module be the normal case? It certainly seems to be a more user-friendly design -- which has been the point of all of my modules.
Just because someone else did a non-userfriendly design 1st doesn't mean it should not or cannot be done, IMO, more user friendly.
A couple of comments. First, if you want to import the default exports *as well as* some additional others, you can use Exporter's feature (the :DEFAULT tag):
use SomeModule qw(:DEFAULT a b c);
or you can also "use" twice:
use SomeModule; # imports default exports
use SomeModule qw(a b c); # import a, b, c
Second, if you use Xporter, your module will behave unlike most CPAN modules out there, because a majority of modules use Exporter. When people see this Perl code:
use SomeModule qw(a b c);
normally they will expect only a, b, and c are exported. If SomeModule uses Xporter, it will also by default export the default exports.
Basically Xporter is just Exporter with a different default (not arguably better or more user-friendly). For the sake of minimizing surprise to my users, I would avoid the use of Xporter.
UPDATE 2014-01-24: some edits. I appreciate the effort of the author to defend her module, though I am not convinced by her arguments.