G'day wanna_code_perl,
You're correct about this being a "rather vague specification". While I can get a general feel for what you want, I don't have any clear picture of:
Keep all of those unknowns in mind while reading the following.
Your problem domain seems to encompass two main areas: units and calculations.
For "units", I'd split that into: canonical representation of a measurement type; and conversion between units in each measurement type. Any measurement that's input should be converted into the canonical unit (e.g. all lengths are represented as metres). All calculations use only the canonical unit. Conversion to some other unit is purely for output presentation. All of this could probably be done by a single module. (I probably wouldn't provide a public interface to this module.)
For "calculations", I'd group those into one or modules (as appropriate — maybe one per discipline). These modules would access the "units" module. The API for any calculation would first convert all (unit) arguments to their canonical form. All internal functions would only use the canonical form. The API would provide some mechanism for presenting output in a non-canonical form.
For the modules themselves, take a look at Exporter. Export nothing by default (@EXPORT = ();). Make liberal use of @EXPORT_OK and %EXPORT_TAGS such that indivual scripts can load just the functionality they need, e.g.
use My::Chemistry::Module qw{specific_halflife_function};
use My::Chemistry::Module qw{:all_halflife_functions};
Decide on usage. You may want: a GUI representing an "unconventional calculator"; some sort of web interface; a commandline tool; or something else. If you keep the modules I described earlier clean (i.e. they perform just their intended functions without knowing, or caring, about who or what uses them), they could easily be used with any number of front-ends.
There's probably many modules available to perform (at least some of) the conversions and calculations you want. Search in http://search.cpan.org/ to see what's available for your specific needs.
-- Ken
In reply to Re: Simple algebraic calculations
by kcott
in thread Simple algebraic calculations
by wanna_code_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |