File: Temperature.pm

package info (click to toggle)
libconvert-units-perl 1%3A0.43-12
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 96 kB
  • sloc: perl: 275; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 924 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package Convert::Units::Temperature;
require 5.004;
require Exporter;

use vars qw($VERSION $self);
$VERSION = "0.21";

use Convert::Units::Base;

my $self = new Convert::Units::Base
  (
# The actual units, relative to each other (in this case, in inches)
    {
          'celsius' => [1.0,    0],
     'fahrenheight' => [5/9,  -32],
           'kelvin' => [1.0, -273]
    },
# Synonyms and abbreviations for these units
    {
       'centigrade' => 'celsius',
                'c' => 'celsius',
                'f' => 'fahrenheight',
                'k' => 'kelvin'
    },
# Mulipliers
    (),
# The default unit to convert to (when none is specified)
    "celsius"
);

# A stub for converting units
sub convert
{
    return $self->convert_units (@_);
}

# A stub for parsing strings (such as "1 foot, 3 inches")
sub parse
{
    return $self->parse_string (@_);
}

1;

__END__