NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
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
udunits
archives: