Data::Vitals::Circumference - A measurement of the circumference around part of the human body.
The Data::Vitals::Height package provides an implementation of the height of a person.
This can be taken by standard backwards against wall or other vertical surface with your heels, seat, shoulders, and head touching the surface. You should be standing straight with your head in a horizontal position.
A rule is placed horizontally and gently pressed down into the hair, so that it presses on the skull. The point at which the rule contacts the wall is noted, and then measured down to the floor.
For height, measurements in both "feet and inches" and centimetres are widespread, and we try to support them both where the intent is obvious.
Any imperial measurement MUST contain two parts, and indicate at least the "feet" indicator. The one case of input without the unit specificier we allow is any single two or three digit number, which is taken to mean centimetres.
For metric, the supported input range is 30cm - 300cm. For imperial, it is 1'0" - 8'11". This range ignores very small babies but is slightly larger than the world record at the top end, and so is fairly all-encompassing.
The ability to customise these legal ranges will be added at a later time.
The following shows samples for the formats accepted.
Metric measurements 180cm Default form 180.5cm Halves (and only halves) are allowed 180 Raw three digit number 95 Raw two digit number 180c Shorthand (or missed the m) 180cms Plural form 180CM Case insensitive 180 cm Whitespace between the type is ignored Imperial Measurements 5'10" Default form 5'10 If a 'feet' indicator is given, inches is implied 5' 10 Whitespace is ignored 5'10 Various inch indicators 5'10i Various inch indicators 5'10in Various inch indicators 5'10inc Various inch indicators 5'10inch Various inch indicators 5'10inche Various inch indicators 5'10inches Various inch indidators 5'10inchs This bad spelling case is known 5f10 Various foot indicators 5ft10 Various foot indicators 5foot10 Various foot indicators 5feet10 Various foot indicators 5foot10" Indicates can be compiled any way 5FEET10 Case insensitive 5' 10" Whitespace is ignored
Regardless of the method that the value is entered, all values are stored internally in centimetres. The default string form of all measurements is also in centimetres.
This is a specific design decision, as there is a long term world trend towards increased metrification. Many countries (such as Germany) use metric values even for the "common man's" understanding of things and people do not know their height in feet and inches.
However, to support those still dealing in inches we ensure that any value initially entered in inches (including optional halves), stored as cms, and returned to inches for presentation will ALWAYS return the original number of inches, including halves.
The conversion functions in Data::Vitals::Util are heavily tested for every possible value in the range to ensure that this is the case.
The new constructor takes a height string and returns a new object representing the height measurement, or undef if there is a problem with the value provided.
new
undef
Currently, there is no explanation of the reason why a value is rejected. Any used may need to just be presented with an "Invalid Value" message.
In future, a mechanism to access error messages following an error will be added.
The as_string method returns the generic string form of the measurement.
as_string
This is also the method called during overloaded stringification. By default, this returns the metric form, which is in centimetres.
The as_metric method returns the metric form of the measurement, which for height measurements is always in centimetres.
as_metric
The as_imperial method returns the imperial form of the measurement, which for height measurements is in feet and inches
as_imperial
The as_cms method explicitly returns the measurement in centimetres.
as_cms
The format of the string returned is similar to 180cm.
180cm
The as_feet method explicitly returns the measurement in feet and inches.
as_feet
The format of the string returned is similar to 5'10"
5'10"
- Add support for metres "1.84m"
- Add a new class as an abstract for both height, circumference, and other length measurements.
Bugs should always be reported via the CPAN bug tracker
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Vitals
For other issues, contact the maintainer.
Adam Kennedy <adamk@cpan.org>
Thank you to Phase N (http://phase-n.com/) for permitting the open sourcing and release of this distribution.
Copyright 2004 - 2008 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install Data::Vitals, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Vitals
CPAN shell
perl -MCPAN -e shell install Data::Vitals
For more information on module installation, please visit the detailed CPAN module installation guide.