# pseudo-Perl only, not for executing Package MeteoAlarmCountries; # ... use stuff... sub new { # ... } sub fetch_country_warnings { my $self = shift; my %p = @_; my $url = _make_url($p{day}, $p{type}); my $content = _fetch_content($url, $self->get_user_agent); my $warnings = _extract_country_warnings($content); return $warnings; } sub _make_url { # ... } sub _fetch_content { # ... } sub get_user_agent { # return static default, # or do a config lookup, # or allow get/set from outside return $ua_string; } sub _extract_country_warnings { my $content = shift; # ... my %lookup_table = ( ... ) my %country_warnings; foreach ( ... split ... ) { # match and lookup $country_warnings{$country} = $something } return \$country_warnings; }