The problem there isn't a "pointless use of OO", but rather an API that isn't very sensible. One is tempted to ask why the module has an interface that forces a user to create an instance, give the instance a number, and then retrieve a string from the instance when a simple class method exported would have worked more easily. I mean, then I have to remember whether the current number in the instance is the one I want-- which is the sort of "internal state of object" knowledge the rest of my program shouldn't have to be thinking about. It would bother me a lot less if the module had fewer steps:
use Lingua::EN::Numbers;
my $n = Lingua::EN::Numbers->new;
print $n->get_string(1281), " fish in the sea.\n";
#or
use Lingua::EN::Numbers qw(get_string);
print get_string(1281), " fish in the sea.\n";
With this sort of interface I have a choice of whether or not to pollute my namespace with a function name (like with CGI.pm, I prefer not to attempt to export all those HTML markup tags as function names).
-
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.
|