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.)
Was this review helpful to you? Yes No
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.
1 out of 1 found this review helpful. Was this review helpful to you? Yes No
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.
8 out of 8 found this review helpful. Was this review helpful to you? Yes No