| 1 | package Weather::OpenWeatherMap::Result::Forecast::Day; | ||
| 2 | 2 | $Weather::OpenWeatherMap::Result::Forecast::Day::VERSION = '0.003001'; | |
| 3 | 2 | ▶ | use strictures 2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | ▶ | use Types::Standard -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | use Types::DateTime -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 2 | ▶ | use List::Objects::Types -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 2 | ▶ | use Weather::OpenWeatherMap::Units -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | |||
| 12 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | has cloud_coverage => ( | ||
| 15 | init_arg => 'clouds', | ||
| 16 | is => 'ro', | ||
| 17 | isa => CoercedInt, | ||
| 18 | coerce => 1, | ||
| 19 | 0 | ▶ | builder => sub { 0 }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
_build_cloud_coverage: not called CC=1 SCAR=6.9
| |||
| 20 | 2 | ); | |
| 21 | |||
| 22 | has humidity => ( | ||
| 23 | is => 'ro', | ||
| 24 | isa => CoercedInt, | ||
| 25 | coerce => 1, | ||
| 26 | 0 | ▶ | builder => sub { 0 }, |
|
Subroutine
_build_humidity: not called CC=1 SCAR=6.9
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 27 | 2 | ); | |
| 28 | |||
| 29 | has pressure => ( | ||
| 30 | is => 'ro', | ||
| 31 | isa => StrictNum, | ||
| 32 | 0 | ▶ | builder => sub { 0 }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 33 | 2 | ); | |
| 34 | |||
| 35 | has wind_speed_mph => ( | ||
| 36 | init_arg => 'speed', | ||
| 37 | is => 'ro', | ||
| 38 | isa => CoercedInt, | ||
| 39 | coerce => 1, | ||
| 40 | 0 | ▶ | builder => sub { 0 }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 41 | 2 | ); | |
| 42 | |||
| 43 | has wind_speed_kph => ( | ||
| 44 | lazy => 1, | ||
| 45 | is => 'ro', | ||
| 46 | isa => CoercedInt, | ||
| 47 | coerce => 1, | ||
| 48 | 2 | ▶ | builder => sub { mph_to_kph shift->wind_speed_mph }, |
|
Subroutine
_build_wind_speed_kph: called CC=1 SCAR=0.0
| |||
| 49 | 2 | ); | |
| 50 | |||
| 51 | has wind_direction => ( | ||
| 52 | lazy => 1, | ||
| 53 | is => 'ro', | ||
| 54 | isa => Str, | ||
| 55 | 4 | ▶ | builder => sub { deg_to_compass shift->wind_direction_degrees }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 56 | 2 | ); | |
| 57 | |||
| 58 | has wind_direction_degrees => ( | ||
| 59 | init_arg => 'deg', | ||
| 60 | is => 'ro', | ||
| 61 | isa => CoercedInt, | ||
| 62 | coerce => 1, | ||
| 63 | 0 | ▶ | builder => sub { 0 }, |
|
Subroutine
_build_wind_direction_degrees: not called CC=1 SCAR=6.9
| |||
| 64 | 2 | ); | |
| 65 | |||
| 66 | 2 | { package | |
| 67 | Weather::OpenWeatherMap::Result::Forecast::Day::Temps; | ||
| 68 | 2 | ▶ | use strict; use warnings FATAL => 'all'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 69 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 70 | has [qw/ morn night eve min max day /], | ||
| 71 | 0 | ▶ | ( is => 'ro', default => sub { 0 } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 72 | } | ||
| 73 | |||
| 74 | has temp => ( | ||
| 75 | is => 'ro', | ||
| 76 | isa => (InstanceOf[__PACKAGE__.'::Temps']) | ||
| 77 | ->plus_coercions( HashRef, | ||
| 78 | sub { | ||
| 79 | 6 | ▶ | Weather::OpenWeatherMap::Result::Forecast::Day::Temps->new(%$_) |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 80 | }, | ||
| 81 | ), | ||
| 82 | coerce => 1, | ||
| 83 | builder => sub { | ||
| 84 | 0 | ▶ | Weather::OpenWeatherMap::Result::Forecast::Day::Temps->new |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 85 | }, | ||
| 86 | 2 | ); | |
| 87 | |||
| 88 | has temp_min_f => ( | ||
| 89 | lazy => 1, | ||
| 90 | is => 'ro', | ||
| 91 | isa => CoercedInt, | ||
| 92 | coerce => 1, | ||
| 93 | 4 | ▶ | builder => sub { shift->temp->min }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 94 | 2 | ); | |
| 95 | |||
| 96 | has temp_max_f => ( | ||
| 97 | lazy => 1, | ||
| 98 | is => 'ro', | ||
| 99 | isa => CoercedInt, | ||
| 100 | coerce => 1, | ||
| 101 | 4 | ▶ | builder => sub { shift->temp->max }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 102 | 2 | ); | |
| 103 | |||
| 104 | has temp_min_c => ( | ||
| 105 | lazy => 1, | ||
| 106 | is => 'ro', | ||
| 107 | isa => CoercedInt, | ||
| 108 | coerce => 1, | ||
| 109 | 4 | ▶ | builder => sub { f_to_c shift->temp_min_f }, |
|
Subroutine
_build_temp_min_c: called CC=1 SCAR=0.0
| |||
| 110 | 2 | ); | |
| 111 | |||
| 112 | has temp_max_c => ( | ||
| 113 | lazy => 1, | ||
| 114 | is => 'ro', | ||
| 115 | isa => CoercedInt, | ||
| 116 | coerce => 1, | ||
| 117 | 4 | ▶ | builder => sub { f_to_c shift->temp_max_f }, |
|
Subroutine
_build_temp_max_c: called CC=1 SCAR=0.0
| |||
| 118 | 2 | ); | |
| 119 | |||
| 120 | |||
| 121 | 2 | with 'Weather::OpenWeatherMap::Result::Forecast::Block'; | |
| 122 | |||
| 123 | |||
| 124 | 2 | 1; | |
| 125 | |||
| 126 | =pod | ||
| 127 | |||
| 128 | =head1 NAME | ||
| 129 | |||
| 130 | Weather::OpenWeatherMap::Result::Forecast::Day - Weather report for a single day | ||
| 131 | |||
| 132 | =head1 SYNOPSIS | ||
| 133 | |||
| 134 | # Usually retrived via a Weather::OpenWeatherMap::Result::Forecast | ||
| 135 | |||
| 136 | =head1 DESCRIPTION | ||
| 137 | |||
| 138 | A L<Weather::OpenWeatherMap> weather forecast for a single day, provided by a | ||
| 139 | L<Weather::OpenWeatherMap::Result::Forecast> daily report. | ||
| 140 | |||
| 141 | This class consumes L<Weather::OpenWeatherMap::Result::Forecast::Block>; look | ||
| 142 | there for other applicable methods and attributes. | ||
| 143 | |||
| 144 | =head2 ATTRIBUTES | ||
| 145 | |||
| 146 | =head3 temp | ||
| 147 | |||
| 148 | An object containing the returned temperature data; this object provides | ||
| 149 | B<morn>, B<night>, B<eve>, B<min>, B<max>, B<day> accessors. | ||
| 150 | |||
| 151 | See L</temp_min_f>, L</temp_max_f>. | ||
| 152 | |||
| 153 | =head3 temp_min_f | ||
| 154 | |||
| 155 | The forecast low temperature, in degrees Fahrenheit. | ||
| 156 | |||
| 157 | =head3 temp_max_f | ||
| 158 | |||
| 159 | The forecast high temperature, in degrees Fahrenheit. | ||
| 160 | |||
| 161 | =head3 temp_min_c | ||
| 162 | |||
| 163 | The forecast low temperature, in degrees Celsius. | ||
| 164 | |||
| 165 | =head3 temp_max_c | ||
| 166 | |||
| 167 | The forecast high temperature, in degrees Celsius. | ||
| 168 | |||
| 169 | =head1 SEE ALSO | ||
| 170 | |||
| 171 | L<http://www.openweathermap.org/forecast16> | ||
| 172 | |||
| 173 | L<Weather::OpenWeatherMap::Result> | ||
| 174 | |||
| 175 | L<Weather::OpenWeatherMap::Result::Forecast> | ||
| 176 | |||
| 177 | L<Weather::OpenWeatherMap::Result::Forecast::Block> | ||
| 178 | |||
| 179 | L<Weather::OpenWeatherMap::Result::Forecast::Hour> | ||
| 180 | |||
| 181 | L<Weather::OpenWeatherMap::Result::Current> | ||
| 182 | |||
| 183 | =head1 AUTHOR | ||
| 184 | |||
| 185 | Jon Portnoy <avenj@cobaltirc.org> | ||
| 186 | |||
| 187 | =cut | ||