Greetings!

I have a need to perform some Interval Computations for one of my projects. Since I was unable to find a module on CPAN I'm going to have to write my own. I would like to upload my module to CPAN so the next lucky stiff doesn't have to repeat my effort. Having never written a module for CPAN before I wanted to get some feedback about my plans before diving too deep. I know there are many answers so I'm not looking for the one true way, but some advice from those who've gone before me.

First, I was thinking of calling my module Math::Interval. That name captures the purpose and isn't unweildy. Another option was Number::Interval since intervals can be a new type of number like complex numbers. If you were looking for a module to perform interval calculations where would you expect to find it?

Next, my plan is to create a class that encapsulates construction and some validation while most of the interface would be contained in functions. For example to add two intervals the user would call Math::Interval::add(iv1, iv1) which would return the result as an interval. Would it be better to put everything inside the class? I know that this would increase potential naming conflicts if people just imported the entire namespace. Code like $arg1->add($arg2) looks wrong to me.

Thanks for any pointers and suggestions!

Update: Fixed broken link. Thanks QM.

Update 2: In this context an interval is a new type of number like a complex number. They can be added, subtracted, multiplied and divided. We can define exponentation, trigonometric functions and a whole host of other functions.

Owl looked at him, and wondered whether to push him off the tree; but, feeling that he could always do it afterwards, he tried once more to find out what they were talking about.


In reply to Interval Computation Module Design by HollyKing

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.