Design philosophy.

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.


In reply to Re (tilly) 1: Exporter by tilly
in thread Exporter by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.