{"id":16671339,"url":"https://github.com/bluefeet/class-measure","last_synced_at":"2026-05-24T10:37:04.601Z","repository":{"id":598415,"uuid":"233945","full_name":"bluefeet/Class-Measure","owner":"bluefeet","description":"Create, compare, and convert units of measurement.","archived":false,"fork":false,"pushed_at":"2023-06-07T19:01:01.000Z","size":61,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-19T17:36:00.213Z","etag":null,"topics":["cpan","perl5"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Class::Measure","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"gocraft/web","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluefeet.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2009-06-23T02:44:41.000Z","updated_at":"2023-06-07T18:59:10.000Z","dependencies_parsed_at":"2023-07-05T15:01:35.407Z","dependency_job_id":null,"html_url":"https://github.com/bluefeet/Class-Measure","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":0.09090909090909094,"last_synced_commit":"20f1cebfe242806bc4732a6333f16f8c89592ecb"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluefeet%2FClass-Measure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluefeet%2FClass-Measure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluefeet%2FClass-Measure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluefeet%2FClass-Measure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluefeet","download_url":"https://codeload.github.com/bluefeet/Class-Measure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243318748,"owners_count":20272137,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpan","perl5"],"created_at":"2024-10-12T11:44:09.596Z","updated_at":"2025-12-26T11:00:04.244Z","avatar_url":"https://github.com/bluefeet.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nClass::Measure - Create, compare, and convert units of measurement.\n\n# SYNOPSIS\n\nSee [Class::Measure::Length](https://metacpan.org/pod/Class%3A%3AMeasure%3A%3ALength) for some examples.\n\n# DESCRIPTION\n\nThis is a base class that is inherited by the Class::Measure \nclasses.  This distribution comes with the class [Class::Measure::Length](https://metacpan.org/pod/Class%3A%3AMeasure%3A%3ALength).\n\nThe classes [Class::Measure::Area](https://metacpan.org/pod/Class%3A%3AMeasure%3A%3AArea), [Class::Measure::Mass](https://metacpan.org/pod/Class%3A%3AMeasure%3A%3AMass),\n[Class::Measure::Space](https://metacpan.org/pod/Class%3A%3AMeasure%3A%3ASpace), [Class::Measure::Temperature](https://metacpan.org/pod/Class%3A%3AMeasure%3A%3ATemperature),\nand [Class::Measure::Volume](https://metacpan.org/pod/Class%3A%3AMeasure%3A%3AVolume) are planned and will be added soon.\n\nThe methods described here are available in all Class::Measure classes.\n\n# METHODS\n\n## new\n\n```perl\nmy $m = new Class::Measure::Length( 1, 'inch' );\n```\n\nCreates a new measurement object.  You must pass an initial\nmeasurement and default unit.\n\nIn most cases the measurement class that you are using\nwill export a method to create new measurements.  For\nexample [Class::Measure::Length](https://metacpan.org/pod/Class%3A%3AMeasure%3A%3ALength) exports the\n`length()` method.\n\n## unit\n\n```perl\nmy $unit = $m-\u003eunit();\n```\n\nReturns the object's default unit.\n\n## set\\_unit\n\n```\n$m-\u003eset_unit( 'feet' );\n```\n\nSets the default unit of the measurement.\n\n## value\n\n```perl\nmy $yards = $m-\u003evalue('yards');\nmy $val = $m-\u003evalue();\nprint \"$m is the same as $val when in a string\\n\";\n```\n\nRetrieves the value of the measurement in the\ndefault unit.  You may specify a unit in which\ncase the value is converted to the unit and returned.\n\nThis method is also used to handle overloading of\nstringifying the object.\n\n## set\\_value\n\n```perl\nmy $m = length( 0, 'inches' );\n$m-\u003eset_value( 12 ); # 12 inches.\n$m-\u003eset_value( 1, 'foot' ); # 1 foot.\n```\n\nSets the measurement in the default unit.  You may\nspecify a new default unit as well.\n\n## reg\\_units\n\n```\nClass::Measure::Length-\u003ereg_units(\n    'inch', 'foot', 'yard',\n);\n```\n\nRegisters one or more units for use in the specified\nclass.  Units should be in the singular, most common,\nform.\n\n## units\n\n```perl\nmy @units = Class::Measure::Length-\u003eunits();\n```\n\nReturns a list of all registered units.\n\n## reg\\_aliases\n\n```perl\nClass::Measure::Length-\u003ereg_aliases(\n    ['feet','ft'] =\u003e 'foot',\n    ['in','inches'] =\u003e 'inch',\n    'yards' =\u003e 'yard'\n);\n```\n\nRegister alternate names for units.  Expects two\narguments per unit to alias.  The first argument\nbeing the alias (scalar) or aliases (array ref), and\nthe second argument being the unit to alias them to.\n\n## reg\\_convs\n\n```perl\nClass::Measure::Length-\u003ereg_convs(\n    12, 'inches' =\u003e 'foot',\n    'yard' =\u003e '3', 'feet'\n);\n```\n\nRegisters a unit conversion.  There are three distinct\nways to specify a new conversion.  Each requires three\narguments.\n\n```perl\n$count1, $unit1 =\u003e $unit2\n$unit1 =\u003e $count2, $unit2\n```\n\nThese first two syntaxes create automatic reverse conversions\nas well.  So, saying there are 12 inches in a foot implies\nthat there are 1/12 feet in an inch.\n\n```perl\n$unit1 =\u003e $unit2, $sub\n```\n\nThe third syntax accepts a subroutine as the last argument\nthe subroutine will be called with the value of $unit1 and\nit's return value will be assigned to $unit2.  This\nthird syntax does not create a reverse conversion automatically.\n\n# SUPPORT\n\nPlease submit bugs and feature requests to the\nClass-Measure GitHub issue tracker:\n\n[https://github.com/bluefeet/Class-Measure/issues](https://github.com/bluefeet/Class-Measure/issues)\n\n# AUTHOR\n\n```\nAran Clary Deltac \u003cbluefeet@gmail.com\u003e\n```\n\n# CONTRIBUTORS\n\n```\nRoland van Ipenburg \u003croland@rolandvanipenburg.com\u003e\n```\n\n# LICENSE\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluefeet%2Fclass-measure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluefeet%2Fclass-measure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluefeet%2Fclass-measure/lists"}