in reply to Exporter
When I program procedurally I almost always use @EXPORT_OK as a declaration of my public interface, and in client modules I am explicit about importing as much or little of it as I need.
However the second format is how you call an OO constructor, which returns a blessed reference through which you can call other things. OO design is a tool that can help make code more understandable. If you are programming in an OO style then you really do want the encapsulation of having your methods associated with objects and not all thrown together in your main package.
For the record the OO calling convention is substantially less efficient than calling a function directly. Finding out what the bottlenecks are that cause this and fixing them is an issue for current development of the language.
UPDATE
Oops, forgot to give my conclusion. (That is what I get
for posting in a hurry!) When I program procedurally I
almost always use Exporter. When I program in an OO
style I almost never would think it appropriate. Each
has its place.
|
|---|