summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-06-16 13:35:19 +0200
committerDaniel Friesel <derf@finalrewind.org>2016-06-16 13:35:19 +0200
commitab3318c5fe1d6e0b767cebc090c8dbaa9dd9a14c (patch)
treedfe35a1ac341113c28b663105318106607aca491 /index.pl
parent1f306b3a5cf9f953a67277f1b10c2ba82c212510 (diff)
index: suddort via list delimited with commas
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl32
1 files changed, 20 insertions, 12 deletions
diff --git a/index.pl b/index.pl
index 7cd6c06..8a6f0e5 100644
--- a/index.pl
+++ b/index.pl
@@ -403,6 +403,7 @@ sub handle_request {
my $line = $result->line;
my $delay = $result->delay;
if ( $via and $result->can('route_post') ) {
+ $via =~ s{ , \s* }{|}gx;
my @route = $result->route_post;
if ( not( List::MoreUtils::any { m{$via}i } @route ) ) {
next;
@@ -813,7 +814,11 @@ get '/_redirect' => sub {
get '/_auto' => sub {
my $self = shift;
- $self->render('geolocation', with_geolocation => 1, hide_opts => 1);
+ $self->render(
+ 'geolocation',
+ with_geolocation => 1,
+ hide_opts => 1
+ );
};
post '/_geolocation' => sub {
@@ -822,23 +827,26 @@ post '/_geolocation' => sub {
my $lon = $self->param('lon');
my $lat = $self->param('lat');
- if (not $lon or not $lat) {
- $self->render(json => {error => 'Invalid lon/lat received'});
+ if ( not $lon or not $lat ) {
+ $self->render( json => { error => 'Invalid lon/lat received' } );
}
else {
my @candidates = map {
{
- ds100 => $_->[0][0],
- name => $_->[0][1],
- eva => $_->[0][2],
- lon => $_->[0][3],
- lat => $_->[0][4],
+ ds100 => $_->[0][0],
+ name => $_->[0][1],
+ eva => $_->[0][2],
+ lon => $_->[0][3],
+ lat => $_->[0][4],
distance => $_->[1],
}
- } Travel::Status::DE::IRIS::Stations::get_station_by_location($lon, $lat, 10);
- $self->render(json => {
- candidates => [ @candidates ],
- });
+ } Travel::Status::DE::IRIS::Stations::get_station_by_location( $lon,
+ $lat, 10 );
+ $self->render(
+ json => {
+ candidates => [@candidates],
+ }
+ );
}
};