summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-12-17 20:09:02 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-12-17 20:09:02 +0100
commit934a9ac21a2747db10840a94aa3ed095063021d2 (patch)
tree04ec3e390d8761950f551a6859d10d15991b503d /lib/Travelynx.pm
parentae21896982b5f53c0a011740f58a97be40bf0b30 (diff)
api/import: More helpful errors, fix "lax" support
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 5c54322..d91fa7a 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -350,20 +350,25 @@ sub startup {
my @unknown_stations;
for my $station ( @{ $opt{route} } ) {
my $station_info = get_station($station);
- if ( not $station_info ) {
+ if ($station_info) {
+ push( @route, [ $station_info->[1], {}, undef ] );
+ }
+ else {
+ push( @route, [ $station, {}, undef ] );
push( @unknown_stations, $station );
}
- push( @route, [ $station_info->[1], {}, undef ] );
}
- if ( @unknown_stations == 1 ) {
- return ( undef,
- "Unbekannter Unterwegshalt: $unknown_stations[0]" );
- }
- elsif (@unknown_stations) {
- return ( undef,
- 'Unbekannte Unterwegshalte: '
- . join( ', ', @unknown_stations ) );
+ if ( not $opt{lax} ) {
+ if ( @unknown_stations == 1 ) {
+ return ( undef,
+ "Unbekannter Unterwegshalt: $unknown_stations[0]" );
+ }
+ elsif (@unknown_stations) {
+ return ( undef,
+ 'Unbekannte Unterwegshalte: '
+ . join( ', ', @unknown_stations ) );
+ }
}
}