aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Map/OSM.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-07-06 17:35:35 +0100
committerMatthew Somerville <matthew@mysociety.org>2015-07-07 14:13:18 +0100
commita978c0a1ad216f7004ef88b8a58b9731242155dc (patch)
tree58ec3daece503b314bb1dfe54ab2d0c0e80cb24e /perllib/FixMyStreet/Map/OSM.pm
parentbeb7e1f345ace940c542d93768ec44bfd6f5dc21 (diff)
Factor out all uses of param()/params.
Use a central get_param and get_param_list functions dependent on whether we're after a scalar or a list (almost always a scalar). This prevents any possibility of confusion where param() could return a list, or params->{} an arrayref.
Diffstat (limited to 'perllib/FixMyStreet/Map/OSM.pm')
-rw-r--r--perllib/FixMyStreet/Map/OSM.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm
index df4b292a8..7d91a9ee7 100644
--- a/perllib/FixMyStreet/Map/OSM.pm
+++ b/perllib/FixMyStreet/Map/OSM.pm
@@ -64,12 +64,12 @@ sub display_map {
$default_zoom = $numZoomLevels - 3 if $dist < 10;
# Map centre may be overridden in the query string
- $params{latitude} = Utils::truncate_coordinate($c->req->params->{lat} + 0)
- if defined $c->req->params->{lat};
- $params{longitude} = Utils::truncate_coordinate($c->req->params->{lon} + 0)
- if defined $c->req->params->{lon};
+ $params{latitude} = Utils::truncate_coordinate($c->get_param('lat') + 0)
+ if defined $c->get_param('lat');
+ $params{longitude} = Utils::truncate_coordinate($c->get_param('lon') + 0)
+ if defined $c->get_param('lon');
- my $zoom = defined $c->req->params->{zoom} ? $c->req->params->{zoom} + 0 : $default_zoom;
+ my $zoom = defined $c->get_param('zoom') ? $c->get_param('zoom') + 0 : $default_zoom;
$zoom = $numZoomLevels - 1 if $zoom >= $numZoomLevels;
$zoom = 0 if $zoom < 0;
$params{zoom_act} = $zoomOffset + $zoom;
@@ -168,7 +168,7 @@ sub click_to_wgs84 {
my ($self, $c, $pin_tile_x, $pin_x, $pin_tile_y, $pin_y) = @_;
my $tile_x = click_to_tile($pin_tile_x, $pin_x);
my $tile_y = click_to_tile($pin_tile_y, $pin_y);
- my $zoom = MIN_ZOOM_LEVEL + (defined $c->req->params->{zoom} ? $c->req->params->{zoom} : 3);
+ my $zoom = MIN_ZOOM_LEVEL + (defined $c->get_param('zoom') ? $c->get_param('zoom') : 3);
my ($lat, $lon) = tile_to_latlon($tile_x, $tile_y, $zoom);
return ( $lat, $lon );
}