| Module Info
| Add a review of Sub-Exporter
Sub::Exporter allows your module's caller to import your functions using their own choice of name. Even if that were the only difference between Exporter.pm and Sub::Exporter it would be well worth switching to the latter. But it's not! Sub::Exporter also gives you generators, which are another awesome feature.
The one drawback of this module is that if you want your import() routine to do something else as well as exporting symbols to the caller, it becomes a little more tricky than with Exporter.pm. It can be done but it ain't pretty. (Hint: write a custom installer.)
While working on an interface with many functions, a great feature over Exporter (that helped find a few bugs/typos) is the strict checking that what I wanted to export was actually defined in my modules.
I have always disliked Exporter.pm, and writing your own &import subs is tedious and error prone. Sub::Exporter makes all that pain and suffering go away. It is a modern replacement for the aging Exporter.pm, and so much more. Next time you find youself writing @EXPORT = (...), think twice and reach for Sub::Exporter instead, you will be happy you did.
Excellent! I love this new breed of modules. Modern, well thought.