| 1 | 1 | ▶ | use 5.10.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package OpenGbg::Service::AirQuality::Measurement; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: An air quality measurement | ||||||||||||||||||||||||||||
| 8 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | ||||||||||||||||||||||||||||
| 9 | our $VERSION = '0.1404'; | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use syntax 'qs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use XML::Rabbit; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use DateTime::Format::HTTP; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use MooseX::AttributeShortcuts; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Types::DateTime qw/DateTime/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | # any attributes/methods added here should also be 'handled' in GetLatestMeasurement. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | has_xpath_value _starttime => './x:StartTime'; | ||||||||||||||||||||||||||||
| 21 | has_xpath_value _endtime => './x:StopTime'; | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | has_xpath_value temperature => './x:Weather/x:Temperature/x:Value'; | ||||||||||||||||||||||||||||
| 24 | has_xpath_value _temperature_unit => './x:Weather/x:Temperature/x:Unit'; | ||||||||||||||||||||||||||||
| 25 | has_xpath_value humidity => './x:Weather/x:Humidity/x:Value'; | ||||||||||||||||||||||||||||
| 26 | has_xpath_value humidity_unit => './x:Weather/x:Humidity/x:Unit'; | ||||||||||||||||||||||||||||
| 27 | has_xpath_value _solar_insolation => './x:Weather/x:SolarInsolation/x:Value'; | ||||||||||||||||||||||||||||
| 28 | has_xpath_value solar_insolation_unit => './x:Weather/x:SolarInsolation/x:Unit'; | ||||||||||||||||||||||||||||
| 29 | has_xpath_value air_pressure => './x:Weather/x:AirPressure/x:Value'; | ||||||||||||||||||||||||||||
| 30 | has_xpath_value air_pressure_unit => './x:Weather/x:AirPressure/x:Unit'; | ||||||||||||||||||||||||||||
| 31 | has_xpath_value wind_speed => './x:Weather/x:WindSpeed/x:Value'; | ||||||||||||||||||||||||||||
| 32 | has_xpath_value wind_speed_unit => './x:Weather/x:WindSpeed/x:Unit'; | ||||||||||||||||||||||||||||
| 33 | has_xpath_value wind_direction => './x:Weather/x:WindDirection/x:Value'; | ||||||||||||||||||||||||||||
| 34 | has_xpath_value _wind_direction_unit => './x:Weather/x:WindDirection/x:Unit'; | ||||||||||||||||||||||||||||
| 35 | has_xpath_value _rainfall => './x:Weather/x:RainFall/x:Value'; | ||||||||||||||||||||||||||||
| 36 | has_xpath_value rainfall_unit => './x:Weather/x:RainFall/x:Unit'; | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | has_xpath_value total_index => './x:AirQuality/x:TotalIndex'; | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | has_xpath_value no2 => './x:AirQuality/x:NO2/x:Value'; | ||||||||||||||||||||||||||||
| 41 | has_xpath_value _no2_unit => './x:AirQuality/x:NO2/x:Unit'; | ||||||||||||||||||||||||||||
| 42 | has_xpath_value no2_index => './x:AirQuality/x:NO2/x:Index'; | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | has_xpath_value so2 => './x:AirQuality/x:SO2/x:Value'; | ||||||||||||||||||||||||||||
| 45 | has_xpath_value _so2_unit => './x:AirQuality/x:SO2/x:Unit'; | ||||||||||||||||||||||||||||
| 46 | has_xpath_value so2_index => './x:AirQuality/x:SO2/x:Index'; | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | has_xpath_value o3 => './x:AirQuality/x:O3/x:Value'; | ||||||||||||||||||||||||||||
| 49 | has_xpath_value _o3_unit => './x:AirQuality/x:O3/x:Unit'; | ||||||||||||||||||||||||||||
| 50 | has_xpath_value o3_index => './x:AirQuality/x:O3/x:Index'; | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | has_xpath_value pm10 => './x:AirQuality/x:PM10/x:Value'; | ||||||||||||||||||||||||||||
| 53 | has_xpath_value _pm10_unit => './x:AirQuality/x:PM10/x:Unit'; | ||||||||||||||||||||||||||||
| 54 | has_xpath_value pm10_index => './x:AirQuality/x:PM10/x:Index'; | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | has_xpath_value co => './x:AirQuality/x:CO/x:Value'; | ||||||||||||||||||||||||||||
| 57 | has_xpath_value _co_unit => './x:AirQuality/x:CO/x:Unit'; | ||||||||||||||||||||||||||||
| 58 | has_xpath_value co_index => './x:AirQuality/x:CO/x:Index'; | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | has_xpath_value nox => './x:AirQuality/x:NOx/x:Value'; | ||||||||||||||||||||||||||||
| 61 | has_xpath_value _nox_unit => './x:AirQuality/x:NOx/x:Unit'; | ||||||||||||||||||||||||||||
| 62 | has_xpath_value nox_index => './x:AirQuality/x:NOx/x:Index'; | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | has_xpath_value pm2_5 => './x:AirQuality/x:PM2_5/x:Value'; | ||||||||||||||||||||||||||||
| 65 | has_xpath_value _pm2_5_unit => './x:AirQuality/x:PM2_5/x:Unit'; | ||||||||||||||||||||||||||||
| 66 | has_xpath_value pm2_5_index => './x:AirQuality/x:PM2_5/x:Index'; | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub solar_insolation { | ||||||||||||||||||||||||||
|
Subroutine
solar_insolation: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 70 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 71 | 0 | ▶ | return length $self->_solar_insolation ? $self->_solar_insolation : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub rainfall { | ||||||||||||||||||||||||||
|
Subroutine
rainfall: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 74 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 75 | 0 | ▶ | return length $self->_rainfall ? $self->_rainfall : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | sub temperature_unit { | ||||||||||||||||||||||||||
|
Subroutine
temperature_unit: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 78 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 79 | 0 | ▶ | return $self->_temperature_unit eq '°C' ? 'degrees C' : $self->_temperature_unit; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub wind_direction_unit { | ||||||||||||||||||||||||||
|
Subroutine
wind_direction_unit: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 82 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 83 | 0 | ▶ | return $self->_wind_direction_unit eq '°' ? 'degrees' : $self->_wind_direction_unit; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub microutf_to_ascii { | ||||||||||||||||||||||||||
|
Subroutine
microutf_to_ascii: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 87 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 88 | 0 | my $unit = shift; | |||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | return $self->_pm2_5_unit eq 'µg/m3' || $self->_pm2_5_unit eq 'ug/m3' ? 'microgram/m3' : $unit; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->_pm2_5_unit eq "\x{b5}g/m3" or $self->_pm2_5_unit eq "ug/m3"
MC/DC0%0/2
$self->_pm2_5_unit eq "\x{b5}g/m3" or $self->_pm2_5_unit eq "ug/m3"
$self->_pm2_5_unit eq "\x{b5}g/m3"
$self->_pm2_5_unit eq "ug/m3"
Truth table0%0/3
A or B
A= $self->_pm2_5_unit eq "\x{b5}g/m3"B= $self->_pm2_5_unit eq "ug/m3"
| |||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub no2_unit { | ||||||||||||||||||||||||||
|
Subroutine
no2_unit: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 94 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 95 | 0 | return $self->microutf_to_ascii($self->_no2_unit); | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub so2_unit { | ||||||||||||||||||||||||||
|
Subroutine
so2_unit: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 98 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 99 | 0 | return $self->microutf_to_ascii($self->_so2_unit); | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub o3_unit { | ||||||||||||||||||||||||||
|
Subroutine
o3_unit: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 102 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 103 | 0 | return $self->microutf_to_ascii($self->_o3_unit); | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | 0 | ▶ | sub co_unit { | ||||||||||||||||||||||||||
|
Subroutine
co_unit: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 106 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 107 | 0 | return $self->microutf_to_ascii($self->_co_unit); | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub pm10_unit { | ||||||||||||||||||||||||||
|
Subroutine
pm10_unit: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 110 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 111 | 0 | return $self->microutf_to_ascii($self->_pm10_unit); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub nox_unit { | ||||||||||||||||||||||||||
|
Subroutine
nox_unit: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 114 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 115 | 0 | return $self->microutf_to_ascii($self->_nox_unit); | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | 0 | ▶ | sub pm2_5_unit { | ||||||||||||||||||||||||||
|
Subroutine
pm2_5_unit: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 118 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 119 | 0 | return $self->microutf_to_ascii($self->_pm2_5_unit); | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub index_to_levels { | ||||||||||||||||||||||||||
|
Subroutine
index_to_levels: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 123 | 0 | my $index = shift; | |||||||||||||||||||||||||||
| 124 | 0 | ▶ | return $index if !$index; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | return $index >= 3 ? 'very high levels' | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 126 | : $index >= 2 ? 'high levels' | ||||||||||||||||||||||||||||
| 127 | : $index >= 1 ? 'medium levels' | ||||||||||||||||||||||||||||
| 128 | : 'low levels' | ||||||||||||||||||||||||||||
| 129 | ; | ||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub total_levels { | ||||||||||||||||||||||||||
|
Subroutine
total_levels: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 132 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 133 | 0 | return $self->index_to_levels($self->total_index); | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | 0 | ▶ | sub no2_levels { | ||||||||||||||||||||||||||
|
Subroutine
no2_levels: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 136 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 137 | 0 | return $self->index_to_levels($self->no2_index); | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub so2_levels { | ||||||||||||||||||||||||||
|
Subroutine
so2_levels: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 140 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 141 | 0 | return $self->index_to_levels($self->so2_index); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub o3_levels { | ||||||||||||||||||||||||||
|
Subroutine
o3_levels: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 144 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 145 | 0 | return $self->index_to_levels($self->o3_index); | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub co_levels { | ||||||||||||||||||||||||||
|
Subroutine
co_levels: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 148 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 149 | 0 | return $self->index_to_levels($self->co_index); | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub pm10_levels { | ||||||||||||||||||||||||||
|
Subroutine
pm10_levels: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 152 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 153 | 0 | return $self->index_to_levels($self->pm10_index); | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | 0 | ▶ | sub nox_levels { | ||||||||||||||||||||||||||
|
Subroutine
nox_levels: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 156 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 157 | 0 | return $self->index_to_levels($self->nox_index); | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub pm2_5_levels { | ||||||||||||||||||||||||||
|
Subroutine
pm2_5_levels: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 160 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 161 | 0 | return $self->index_to_levels($self->pm2_5_index); | |||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | has starttime => ( | ||||||||||||||||||||||||||||
| 166 | is => 'ro', | ||||||||||||||||||||||||||||
| 167 | isa => DateTime, | ||||||||||||||||||||||||||||
| 168 | lazy => 1, | ||||||||||||||||||||||||||||
| 169 | builder => 1, | ||||||||||||||||||||||||||||
| 170 | ); | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | has endtime => ( | ||||||||||||||||||||||||||||
| 173 | is => 'ro', | ||||||||||||||||||||||||||||
| 174 | isa => DateTime, | ||||||||||||||||||||||||||||
| 175 | lazy => 1, | ||||||||||||||||||||||||||||
| 176 | builder => 1, | ||||||||||||||||||||||||||||
| 177 | ); | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 0 | ▶ | sub _build_starttime { | ||||||||||||||||||||||||||
|
Subroutine
_build_starttime: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 180 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 181 | 0 | return DateTime::Format::HTTP->parse_datetime($self->_starttime); | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub _build_endtime { | ||||||||||||||||||||||||||
|
Subroutine
_build_endtime: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 184 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 185 | 0 | return DateTime::Format::HTTP->parse_datetime($self->_endtime); | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub to_text { | ||||||||||||||||||||||||||
|
Subroutine
to_text: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 189 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 190 | 0 | return sprintf "\n%s %s -- %s %s\n%s%s", $self->starttime->ymd('-'), | |||||||||||||||||||||||||||
| 191 | $self->starttime->hms(':'), | ||||||||||||||||||||||||||||
| 192 | $self->endtime->ymd('-'), | ||||||||||||||||||||||||||||
| 193 | $self->endtime->hms(':'), | ||||||||||||||||||||||||||||
| 194 | $self->weather_to_text, | ||||||||||||||||||||||||||||
| 195 | $self->air_quality_to_text; | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | sub weather_to_text { | ||||||||||||||||||||||||||||
| 199 | my $self = shift; | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | return sprintf qs{ | ||||||||||||||||||||||||||||
| 202 | Temperature: %7.2f %s | ||||||||||||||||||||||||||||
| 203 | Humiditiy: %7.2f %s | ||||||||||||||||||||||||||||
| 204 | Solar insolation: %7.2f %s | ||||||||||||||||||||||||||||
| 205 | Air pressure: %7.2f %s | ||||||||||||||||||||||||||||
| 206 | Wind speed: %7.2f %s | ||||||||||||||||||||||||||||
| 207 | Wind direction: %7.2f %s | ||||||||||||||||||||||||||||
| 208 | Rainfall: %7.2f %s | ||||||||||||||||||||||||||||
| 209 | }, | ||||||||||||||||||||||||||||
| 210 | $self->temperature, | ||||||||||||||||||||||||||||
| 211 | $self->temperature_unit, | ||||||||||||||||||||||||||||
| 212 | $self->humidity, | ||||||||||||||||||||||||||||
| 213 | $self->humidity_unit, | ||||||||||||||||||||||||||||
| 214 | $self->solar_insolation, | ||||||||||||||||||||||||||||
| 215 | $self->solar_insolation_unit, | ||||||||||||||||||||||||||||
| 216 | $self->air_pressure, | ||||||||||||||||||||||||||||
| 217 | $self->air_pressure_unit, | ||||||||||||||||||||||||||||
| 218 | $self->wind_speed, | ||||||||||||||||||||||||||||
| 219 | $self->wind_speed_unit, | ||||||||||||||||||||||||||||
| 220 | $self->wind_direction, | ||||||||||||||||||||||||||||
| 221 | $self->wind_direction_unit, | ||||||||||||||||||||||||||||
| 222 | $self->rainfall, | ||||||||||||||||||||||||||||
| 223 | $self->rainfall_unit | ||||||||||||||||||||||||||||
| 224 | ; | ||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | sub air_quality_to_text { | ||||||||||||||||||||||||||||
| 228 | my $self = shift; | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | no warnings 'numeric'; | ||||||||||||||||||||||||||||
| 231 | return sprintf qs{ | ||||||||||||||||||||||||||||
| 232 | Total index: [ %4s ] [ %-16s ] | ||||||||||||||||||||||||||||
| 233 | Nitrogen dioxide: %7.2f %s [ %4s ] [ %-16s ] | ||||||||||||||||||||||||||||
| 234 | Nitrogen oxides: %7.2f %s [ %4s ] [ %-16s ] | ||||||||||||||||||||||||||||
| 235 | Sulfur dioxide: %7.2f %s [ %4s ] [ %-16s ] | ||||||||||||||||||||||||||||
| 236 | Carbon monoxide: %7.2f %s [ %4s ] [ %-16s ] | ||||||||||||||||||||||||||||
| 237 | Ground level ozone: %7.2f %s [ %4s ] [ %-16s ] | ||||||||||||||||||||||||||||
| 238 | <10mm particulates: %7.2f %s [ %4s ] [ %-16s ] | ||||||||||||||||||||||||||||
| 239 | <2.5mm particulates: %7.2f %s [ %4s ] [ %-16s ] | ||||||||||||||||||||||||||||
| 240 | }, | ||||||||||||||||||||||||||||
| 241 | $self->total_index, | ||||||||||||||||||||||||||||
| 242 | $self->total_levels, | ||||||||||||||||||||||||||||
| 243 | $self->no2, | ||||||||||||||||||||||||||||
| 244 | $self->no2_unit, | ||||||||||||||||||||||||||||
| 245 | $self->no2_index, | ||||||||||||||||||||||||||||
| 246 | $self->no2_levels, | ||||||||||||||||||||||||||||
| 247 | $self->so2, | ||||||||||||||||||||||||||||
| 248 | $self->so2_unit, | ||||||||||||||||||||||||||||
| 249 | $self->so2_index, | ||||||||||||||||||||||||||||
| 250 | $self->so2_levels, | ||||||||||||||||||||||||||||
| 251 | $self->o3, | ||||||||||||||||||||||||||||
| 252 | $self->o3_unit, | ||||||||||||||||||||||||||||
| 253 | $self->o3_index, | ||||||||||||||||||||||||||||
| 254 | $self->o3_levels, | ||||||||||||||||||||||||||||
| 255 | $self->pm10, | ||||||||||||||||||||||||||||
| 256 | $self->pm10_unit, | ||||||||||||||||||||||||||||
| 257 | $self->pm10_index, | ||||||||||||||||||||||||||||
| 258 | $self->pm10_levels, | ||||||||||||||||||||||||||||
| 259 | $self->co, | ||||||||||||||||||||||||||||
| 260 | $self->co_unit, | ||||||||||||||||||||||||||||
| 261 | $self->co_index, | ||||||||||||||||||||||||||||
| 262 | $self->co_levels, | ||||||||||||||||||||||||||||
| 263 | $self->nox, | ||||||||||||||||||||||||||||
| 264 | $self->nox_unit, | ||||||||||||||||||||||||||||
| 265 | $self->nox_index, | ||||||||||||||||||||||||||||
| 266 | $self->nox_levels, | ||||||||||||||||||||||||||||
| 267 | $self->pm2_5, | ||||||||||||||||||||||||||||
| 268 | $self->pm2_5_unit, | ||||||||||||||||||||||||||||
| 269 | $self->pm2_5_index, | ||||||||||||||||||||||||||||
| 270 | $self->pm2_5_levels, | ||||||||||||||||||||||||||||
| 271 | ; | ||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | finalize_class(); | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 1; | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | __END__ | ||||||||||||||||||||||||||||