Convert::Pluggable - convert between various units of measurement
Version 0.030
convert between various units of measurement
use Convert::Pluggable;
...
my $result = $c-convert( { 'factor' => '5', 'from_unit' => 'feet', 'to_unit' => 'inches', 'precision' => '3', } ); >
my $result = $c-
will produce '60.000'.
See Convert-Pluggable.t for many more example uses.
See https://ddh5.duckduckgo.com/?q=10000+minutes+in+microseconds for test uses
convert
Create a new Conversion object.
A function for converting between various temperature units. Currently supports Fahrenheit, Celsius, Kelvin, Rankine, and Raumur.
This is the workhorse. All conversion work (except for temperatures) gets done here. This is the only exported sub.
get factors for later calculating conversion
get trigger 'types' to determine if we can perform a calculation in the first place
get canoncial units for massaging output
determine if a unit may be negative
This gets some useful metadata for convert() to carry out its work.
This is where you add new unit types so that convert() can operate on them. Currently supported units of measurement are: mass, length, time, pressure, energy, power, angle, force, temperature, digital.
handle numbers with special characters in them, like '6^2' and '2e3'.
bradley andersen, <bradley at pvnp.us>
<bradley at pvnp.us>
Because of the base unit ('day'), time conversions are off:
e.g.: '1 year to months' yields: '1 year is 11.999 months'
add back in guard against things like: '10 inches to 5 cm'
You can find documentation for this module with the perldoc command.
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Convert::Pluggable
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Convert::Pluggable
CPAN Ratings
http://cpanratings.perl.org/d/Convert::Pluggable
Search CPAN
http://search.cpan.org/dist/Convert::Pluggable/
Special thanks to @mintsoft and @jagtalon
Copyright (c) 2014 Bradley Andersen. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Bot::BasicBot::Pluggable::Module::Convert
relies on
Math::Units
add DDG massaging later if useful
better error handling
all args to functions should be hash refs!
store units data in a file?
add more unit types (digital, cooking, etc.)
support native perl numbers in queries: e.g.: '12.34e-56 cm to mm'
don't show decimals when integer answer? e.g.: '12.000' should be '12' (this may be something we leave to implementation)
add more tests and better test output
'1 year to months'
'16 years to months'
'12.34e-56 cm to mm'
'10 inches to 5 cm'
fix tests
fix this documentation!
what happens when two units have the same notation? (e.g., 'kilometer' and 'kilobyte' both can use 'K')
To install Convert::Pluggable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Convert::Pluggable
CPAN shell
perl -MCPAN -e shell install Convert::Pluggable
For more information on module installation, please visit the detailed CPAN module installation guide.