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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |