- To: udunits@xxxxxxxxxxxxxxxx
- Subject: [udunits] Announcement: Physics::Udunits2, a perl-wrapper for udunits2
- From: Heiko Klein <Heiko.Klein@xxxxxx>
- Date: Thu, 06 Aug 2009 13:26:33 +0200
I just uploaded a perl-wrapper for the udunits2 library to CPAN. The
package name is Physics::Udunits2 and it will appear as
Physics-Udunits2-0.03.tar.gz under
http://www.perl.com/CPAN/modules/by-authors/id/H/HE/HEIKOK/
It might take some hours to get there due to internal CPAN handling.Physics::Udunits2 is a thin wrapper around the udunits2 package. It supports most functions of the C-API documentation. The following function groups have been left out in the current release: visitors, formatting of unit-names, and mapping of names and symbols.
A short example: use Physics::Udunits2; my $system = new Physics::Udunits2(); my $mUnit = $system->getUnit("m"); my $kmUnit = $system->getUnit("km"); if ($mUnit->isConvertibleTo($kmUnit)) { my $converter = $mUnit->getConverterTo($kmUnit); foreach my $num (1..1000) { printf("%fm = %fkm\n", $num, $converter->convert($num)); } } Feedback is welcome. Heiko