3 # Routino router results retrieval CGI
5 # Part of the Routino routing software.
7 # This file Copyright 2008-2010 Andrew M. Bishop
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU Affero General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU Affero General Public License for more details.
19 # You should have received a copy of the GNU Affero General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # Use the directory paths script
26 # Use the generic router script
29 # Use the perl CGI module
32 # Create the query and get the parameters
36 @rawparams=$query->param;
38 # Legal CGI parameters with regexp validity check
41 "type" => "(shortest|quickest)",
42 "format" => "(html|gpx-route|gpx-track|text|text-all)",
44 "uuid" => "[0-9a-f]{32}"
47 # Validate the CGI parameters, ignore invalid ones
49 foreach $key (@rawparams)
51 foreach $test (keys (%legalparams))
53 if($key =~ m%^$test$%)
55 $value=$query->param($key);
57 if($value =~ m%^$legalparams{$test}$%)
59 $cgiparams{$key}=$value;
66 # Parse the parameters
68 $uuid =$cgiparams{"uuid"};
69 $type =$cgiparams{"type"};
70 $format=$cgiparams{"format"};
74 ReturnOutput($uuid,$type,$format);