Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (33 sloc) 1.6 KB


Provide basic information on the current weather for a specified location. The information must be available for as many countries as possible and needs to include temperature, possibility of precipitation, wind speed, humidex, and windchill. The information is to be provided for the current day only (no hourly or multi-day forecasts).


The implementation is a module that provides a function to retrieve weather information. Currently supported service is OpenWeatherMap, but the implementation must allow for easy replacement of services.




my $result = weather-for 'Brampton', 'ca';

printf "Current weather is: %d℃, %dmm precip/3hr, wind %dm/s\n",
    .temp, .precip, .wind given $result;

Takes two positional arguments—name of the city and ISO country code—to provide weather information for. The country is optional and by default is not specified.

Returns a Weather::Result object on success, otherwise returns a Failure. The object provides these methods:


say "Current temperature is $result.temp()℃"

Takes no arguments. Returns the Numeric temperature in degrees Celcius.


say "Expected to receive $result.precip()mm/3hr of percipitation";

Takes no arguments. Returns the Numeric amount of precipitation in millimeters per three hours.


say "Wind speed is $result.wind()m/s";

Takes no arguments. Returns the Numeric wind speed in meters per second.

You can’t perform that action at this time.