Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
... I am trying to learn how to create modules and needed something to work on. ... create a module out of [this monstrosity] by doing the required changes, test the output by checking it ...

This seems like a reasonable way to learn about creating modules: start with a lousy algorithm, create a MyModule.pm that exports something like is_prime(), create a MyModule.t for the module to test its correct operation (and which can also test execution time), then start improving the algorithm to exercise the process of developing, improving and maintaining the module.

Ok, you've got the lousy algorithm. So where's the module and its .t script? That seems to me to be the thing to focus on right now. (There are even some who say that one should write the .t script before writing the module!) Believe me, you'll find plenty of ways to improve and extend things once you've got the algorithm encapsulated in a module along with a .t script for it, i.e., once the interface is defined and testable. Interface definition and creation of a testing environment is the first step. Go for it. But at this stage, why are you worrying about better algorithms?


Give a man a fish:  <%-{-{-{-<


In reply to Re: Stupidest Prime Number detector ever!! by AnomalousMonk
in thread Stupidest Prime Number detector ever!! 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":



  • 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 musing on the Monastery: (2)
As of 2024-04-20 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found