Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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).

In reply to Re: Re: Use modules or roll your own? by ichimunki
in thread Use modules or roll your own? by kvale

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



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found