exporting new isn't useful. Its there more to say to the user of the module, this is the way in. I'm in the camp that doesn't like namespace pollution, so I try to push my bias along to the next person. Either A) they will instantiate via the constructor, or B) they will have to fully qualify all calls via Package::Name::function
I wasn't having a go at ya - honest! I was attempting to understand you're motivations for having new() in EXPORT_OK, indeed for using Exporter in an OO module at all. Typically an OO constructor wouldn't work if imported into another package.
I'm in complete agreement with your goal of making your code use intentions explicit in the code itself. However, I don't think that putting new() in EXPORT_OK is going to act as a useful cue in the way that you think.
Normally an OO module will not use Exporter at all. If I see an EXPORT_OK my assumption will be that the code isn't OO - exactly the opposite of the point you're trying to get across.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|