line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Weather::YR::Model::Temperature; |
2
|
3
|
|
|
3
|
|
1663
|
use Moose; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
21
|
|
3
|
3
|
|
|
3
|
|
11701
|
use namespace::autoclean; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
25
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Weather::YR::Model'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Weather::YR::Model::Temperature |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This class represents a data point's "temperature". |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 METHODS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This class inherits all the methods from L<Weather::YR::Model> and provides the |
18
|
|
|
|
|
|
|
following new methods: |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 celsius |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Returns the current data point's temperature in celsius. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'celsius' => ( |
27
|
|
|
|
|
|
|
isa => 'Num', |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
required => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 fahrenheit |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Returns the current data point's temperature in fahrenheit. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub fahrenheit { |
39
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $fahrenheit = ( ($self->celsius * 9) / 5 ) + 32; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return sprintf( '%.2f', $fahrenheit ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 kelvin |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Returns the current data point's temperature in kelvin. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub kelvin { |
53
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return sprintf( '%.2f', $self->celsius + 273.15 ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
# The End |
60
|
|
|
|
|
|
|
# |
61
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |