| 1 | package Weather::YR::Model::WindSpeed; | ||
| 2 | 3 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 3 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 3 | extends 'Weather::YR::Model'; | |
| 6 | |||
| 7 | =encoding utf-8 | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Weather::YR::Model::WindSpeed | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | This class represents a data point's wind speed. | ||
| 16 | |||
| 17 | =head1 METHODS | ||
| 18 | |||
| 19 | This class inherits all the methods from L<Weather::YR::Model> and provides the | ||
| 20 | following new methods: | ||
| 21 | |||
| 22 | =head2 mps | ||
| 23 | |||
| 24 | Returns the current data point's wind speed in meters pr. second. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | 3 | has 'mps' => ( | |
| 29 | isa => 'Num', | ||
| 30 | is => 'ro', | ||
| 31 | required => 1, | ||
| 32 | ); | ||
| 33 | |||
| 34 | =head2 fps | ||
| 35 | |||
| 36 | Returns the current data point's wind speed in feet pr. second. | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | 3 | has 'fps' => ( | |
| 41 | isa => 'Num', | ||
| 42 | is => 'ro', | ||
| 43 | lazy_build => 1, | ||
| 44 | ); | ||
| 45 | |||
| 46 | 0 | ▶ | sub _build_fps { |
|
Subroutine
_build_fps: not called CC=1 SCAR=6.9
| |||
| 47 | 0 | my $self = shift; | |
| 48 | |||
| 49 | 0 | return sprintf( '%.1f', $self->mps * 3.28083989501312 ); | |
| 50 | } | ||
| 51 | |||
| 52 | =head2 beaufort | ||
| 53 | |||
| 54 | Returns the current data point's wind speed on the beaufort scale. | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | 3 | has 'beaufort' => ( | |
| 59 | isa => 'Num', | ||
| 60 | is => 'ro', | ||
| 61 | required => 1, | ||
| 62 | ); | ||
| 63 | |||
| 64 | =head2 name | ||
| 65 | |||
| 66 | Returns the current data point's wind speed described with a string. | ||
| 67 | |||
| 68 | Only Norwegian (bokmål) is supported at the moment. | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | 3 | has 'name' => ( | |
| 73 | isa => 'Str', | ||
| 74 | is => 'ro', | ||
| 75 | required => 1, | ||
| 76 | ); | ||
| 77 | |||
| 78 | # | ||
| 79 | # The End | ||
| 80 | # | ||
| 81 | 3 | __PACKAGE__->meta->make_immutable; | |
| 82 | |||
| 83 | 3 | 1; | |